Skip to content

Commit

Permalink
Added show command
Browse files Browse the repository at this point in the history
  • Loading branch information
harrydowning committed May 15, 2023
1 parent 96f8452 commit 8d8f66a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/serl/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
install install language to {SYSTEM_CONFIG_DIR} in home directory.
uninstall Uninstall language from {SYSTEM_CONFIG_DIR} in home directory.
list list installed languages.
show Display language.
run Execute language.
help Show help for commands.
Expand Down Expand Up @@ -62,6 +63,16 @@
{OPTIONS}"""

CLI_SHOW = f"""{NAME} show
Usage:
show [options] <language>
Show Options:
-o, --output=FILE Write language config to file.
{OPTIONS}"""

RUN_OPTIONS = f"""Run Options:
-r, --requirements Install pip requirements.
--debug-lexer Output tokens found line-by-line.
Expand Down Expand Up @@ -104,6 +115,7 @@
'install': CLI_INSTALL,
'uninstall': CLI_UNINSTALL,
'list': CLI_LIST,
'show': CLI_SHOW,
'run': CLI_RUN,
'help': CLI_HELP
}
Expand Down
7 changes: 7 additions & 0 deletions src/serl/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,13 @@ def command_line_list(args):
else:
print(*files, sep='\n')

def command_line_show(args):
language = args['<language>']
config_text = get_config_text(language, get_link_filename())
filename = args['--output'] or 1
with open(filename, 'w') as file:
file.write(config_text)

def get_symlink_args(filename, version) -> dict:
# Stop initial args acting on the tool and not the language
if not '--' in sys.argv:
Expand Down

0 comments on commit 8d8f66a

Please sign in to comment.