mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
parent
4238ca57de
commit
28093894ad
2 changed files with 22 additions and 0 deletions
|
@ -130,3 +130,8 @@ Feature: Basic reading and writing to a journal
|
||||||
and we change directory to "features"
|
and we change directory to "features"
|
||||||
and we run "jrnl -n 1"
|
and we run "jrnl -n 1"
|
||||||
Then the output should contain "hello world"
|
Then the output should contain "hello world"
|
||||||
|
|
||||||
|
Scenario: --diagnostic runs without exceptions
|
||||||
|
When we run "jrnl --diagnostic"
|
||||||
|
Then the output should contain "jrnl"
|
||||||
|
And the output should contain "Python"
|
||||||
|
|
17
jrnl/cli.py
17
jrnl/cli.py
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
|
import platform
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -43,6 +44,14 @@ def parse_args(args=None):
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="prints version information and exits",
|
help="prints version information and exits",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--diagnostic",
|
||||||
|
dest="diagnostic",
|
||||||
|
action="store_true",
|
||||||
|
help="outputs diagnostic information and exits",
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-ls", dest="ls", action="store_true", help="displays accessible journals"
|
"-ls", dest="ls", action="store_true", help="displays accessible journals"
|
||||||
)
|
)
|
||||||
|
@ -315,6 +324,14 @@ def run(manual_args=None):
|
||||||
print(version_str)
|
print(version_str)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
if args.diagnostic:
|
||||||
|
print(
|
||||||
|
f"jrnl: {jrnl.__version__}\n"
|
||||||
|
f"Python: {sys.version}\n"
|
||||||
|
f"OS: {platform.system()} {platform.release()}"
|
||||||
|
)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
config = install.load_or_install_jrnl()
|
config = install.load_or_install_jrnl()
|
||||||
except UserAbort as err:
|
except UserAbort as err:
|
||||||
|
|
Loading…
Add table
Reference in a new issue