laforge submitted this change.

View Change

Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved
shell: Proper argparser (for help + manual) activate_file

Change-Id: I5929ae3deff4d15b5db4a1d866576271c57a955f
---
M docs/shell.rst
M pySim-shell.py
2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/docs/shell.rst b/docs/shell.rst
index 58588a2..fcc171b 100644
--- a/docs/shell.rst
+++ b/docs/shell.rst
@@ -143,7 +143,12 @@

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 ad76ba0..ec417c7 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -805,13 +805,15 @@
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"""

To view, visit change 27235. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I5929ae3deff4d15b5db4a1d866576271c57a955f
Gerrit-Change-Number: 27235
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-MessageType: merged