From 799c3548274c50cae0106610b3ffd169da878946 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 15 Feb 2022 15:56:28 +0100 Subject: [PATCH] shell: Proper argparser (for help + manual) activate_file Change-Id: I5929ae3deff4d15b5db4a1d866576271c57a955f --- docs/shell.rst | 7 ++++++- pySim-shell.py | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/shell.rst b/docs/shell.rst index 58588a2c..fcc171bd 100644 --- a/docs/shell.rst +++ b/docs/shell.rst @@ -143,7 +143,12 @@ Deactivate the currently selected file. This used to be called INVALIDATE in TS activate_file ~~~~~~~~~~~~~ -Activate the currently selected file. This used to be called REHABILITATE in TS 11.11. +Activate the specified file. This used to be called REHABILITATE in TS 11.11. +You need to specify the name or FID of the file to activate. + +.. argparse:: + :module: pySim-shell + :func: Iso7816Commands.activate_file_parser open_channel ~~~~~~~~~~~~ diff --git a/pySim-shell.py b/pySim-shell.py index ad76ba01..ec417c78 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -805,13 +805,15 @@ class Iso7816Commands(CommandSet): self._cmd.poutput("CHV enable successful") def do_deactivate_file(self, opts): - """Deactivate the current EF""" + """Deactivate the currently selected EF""" (data, sw) = self._cmd.card._scc.deactivate_file() + activate_file_parser = argparse.ArgumentParser() + activate_file_parser.add_argument('NAME', type=str, help='File name or FID of file to activate') + @cmd2.with_argparser(activate_file_parser) def do_activate_file(self, opts): """Activate the specified EF""" - path = opts.arg_list[0] - (data, sw) = self._cmd.rs.activate_file(path) + (data, sw) = self._cmd.rs.activate_file(opts.NAME) def complete_activate_file(self, text, line, begidx, endidx) -> List[str]: """Command Line tab completion for ACTIVATE FILE"""