Skip to content

Commit

Permalink
Merge pull request #342 from babsey/CLI_script_content
Browse files Browse the repository at this point in the history
print script content in CLI
  • Loading branch information
apdavison authored Sep 10, 2017
2 parents 4caf1d9 + f836377 commit f71e93f
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion sumatra/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
logger.debug("STARTING")

modes = ("init", "configure", "info", "run", "list", "delete", "comment", "tag",
"repeat", "diff", "help", "export", "upgrade", "sync", "migrate", "version")
"repeat", "diff", "help", "export", "upgrade", "sync", "migrate", "version",
"script")

store_arg_help = "The argument can take the following forms: (1) `/path/to/sqlitedb` - DjangoRecordStore is used with the specified Sqlite database, (2) `http[s]://location` - remote HTTPRecordStore is used with a remote Sumatra server, (3) `postgres://username:password@hostname/databasename` - DjangoRecordStore is used with specified Postgres database."

Expand Down Expand Up @@ -756,6 +757,23 @@ def migrate(argv):
# should we also change the default values stored in the Project?


def script(argv):
"""Print script content of the recording label."""
usage = "%(prog)s script"
description = "Print script content of the recording label."
parser = ArgumentParser(usage=usage,
description=description)
parser.add_argument('label')
args = parser.parse_args(argv)
project = load_project()
record = project.get_record(args.label)
print('Main_File\t :',record.main_file)
print('Version\t\t :',record.version)
print(80*'-')
print(record.script_content)
print(80*'-')


def version(argv):
usage = "%(prog)s version"
description = "Print the Sumatra version."
Expand Down

0 comments on commit f71e93f

Please sign in to comment.