Skip to content

Commit

Permalink
adding preview of output file name with --preview argument on status …
Browse files Browse the repository at this point in the history
…subcommand
  • Loading branch information
mrmiguez committed Nov 2, 2022
1 parent cda6907 commit a12f6b6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
29 changes: 20 additions & 9 deletions manatus/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,26 @@

# Application status
if args.subcommand == 'status':
print("These config files are loaded:")
print(f" {os.path.join(CONFIG_PATH, 'manatus.cfg')}")
print(f" {os.path.join(CONFIG_PATH, 'manatus_harvests.cfg')}")
print(f" {os.path.join(CONFIG_PATH, 'manatus_scenarios.cfg')}")
print("XML data path:")
print(f" {os.path.abspath(manatus_config[profile]['InFilePath'])}")
print("JSON data path:")
print(f" {os.path.abspath(manatus_config[profile]['OutFilePath'])}")
sys.exit(0)
if not args.preview:
print("These config files are loaded:")
print(f" {os.path.join(CONFIG_PATH, 'manatus.cfg')}")
print(f" {os.path.join(CONFIG_PATH, 'manatus_harvests.cfg')}")
print(f" {os.path.join(CONFIG_PATH, 'manatus_scenarios.cfg')}")
print("XML data path:")
print(f" {os.path.abspath(manatus_config[profile]['InFilePath'])}")
print("JSON data path:")
print(f" {os.path.abspath(manatus_config[profile]['OutFilePath'])}")
sys.exit(0)

# Application output preview
if args.preview == 'json':
from datetime import date
print(f"{manatus_config[profile]['OutFilePath']}/{manatus_config[profile]['OutFilePrefix']}-{date.today()}.json")
sys.exit(0)
if args.preview == 'jsonl':
from datetime import date
print(f"{manatus_config[profile]['OutFilePath']}/{manatus_config[profile]['OutFilePrefix']}-{date.today()}.jsonl")
sys.exit(0)

#######################
# Harvest sub-command #
Expand Down
4 changes: 3 additions & 1 deletion manatus/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def argument_parser():
formatter_class=CustomHelpFormatter)
subcommand_parsers = arg_parser.add_subparsers(help='subcommands', dest='subcommand')
subcommand_parsers.required = False
subcommand_parsers.add_parser('status', help='show status')

status_parser = subcommand_parsers.add_parser('status', help='show status')
status_parser.add_argument('--preview', choices=['json', 'jsonl'], help='preview output filename')

# generic config parser
# adds options to harvest & transform subcommands
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='manatus',
version='1.0.5',
version='1.0.6',
packages=find_packages(),
url='http://github.com/SunshineStateDigitalNetwork/manatus',
license='MIT',
Expand Down
2 changes: 1 addition & 1 deletion source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

# The full version, including alpha/beta/rc tags
# release = __version__
release = '1.0.5'
release = '1.0.6'

# -- General configuration ---------------------------------------------------

Expand Down

0 comments on commit a12f6b6

Please sign in to comment.