Compare commits
2 Commits
neels/saip
...
fixeria/cm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f38800643 | ||
|
|
d5c1bec869 |
@@ -23,7 +23,7 @@ import json
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import cmd2
|
import cmd2
|
||||||
from cmd2 import style, fg
|
from cmd2 import style, Fg
|
||||||
from cmd2 import CommandSet, with_default_category, with_argparser
|
from cmd2 import CommandSet, with_default_category, with_argparser
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
@@ -134,8 +134,8 @@ class PysimApp(cmd2.Cmd):
|
|||||||
|
|
||||||
def __init__(self, card, rs, sl, ch, script=None):
|
def __init__(self, card, rs, sl, ch, script=None):
|
||||||
super().__init__(persistent_history_file='~/.pysim_shell_history', allow_cli_args=False,
|
super().__init__(persistent_history_file='~/.pysim_shell_history', allow_cli_args=False,
|
||||||
use_ipython=True, auto_load_commands=False, startup_script=script)
|
auto_load_commands=False, startup_script=script)
|
||||||
self.intro = style('Welcome to pySim-shell!', fg=fg.red)
|
self.intro = style('Welcome to pySim-shell!', fg=Fg.RED)
|
||||||
self.default_category = 'pySim-shell built-in commands'
|
self.default_category = 'pySim-shell built-in commands'
|
||||||
self.card = None
|
self.card = None
|
||||||
self.rs = None
|
self.rs = None
|
||||||
@@ -145,16 +145,16 @@ class PysimApp(cmd2.Cmd):
|
|||||||
self.ch = ch
|
self.ch = ch
|
||||||
|
|
||||||
self.numeric_path = False
|
self.numeric_path = False
|
||||||
self.add_settable(cmd2.Settable('numeric_path', bool, 'Print File IDs instead of names',
|
self.add_settable(cmd2.Settable('numeric_path', bool, 'Print File IDs instead of names', self,
|
||||||
onchange_cb=self._onchange_numeric_path))
|
onchange_cb=self._onchange_numeric_path))
|
||||||
self.conserve_write = True
|
self.conserve_write = True
|
||||||
self.add_settable(cmd2.Settable('conserve_write', bool, 'Read and compare before write',
|
self.add_settable(cmd2.Settable('conserve_write', bool, 'Read and compare before write', self,
|
||||||
onchange_cb=self._onchange_conserve_write))
|
onchange_cb=self._onchange_conserve_write))
|
||||||
self.json_pretty_print = True
|
self.json_pretty_print = True
|
||||||
self.add_settable(cmd2.Settable('json_pretty_print',
|
self.add_settable(cmd2.Settable('json_pretty_print',
|
||||||
bool, 'Pretty-Print JSON output'))
|
bool, 'Pretty-Print JSON output', self))
|
||||||
self.apdu_trace = False
|
self.apdu_trace = False
|
||||||
self.add_settable(cmd2.Settable('apdu_trace', bool, 'Trace and display APDUs exchanged with card',
|
self.add_settable(cmd2.Settable('apdu_trace', bool, 'Trace and display APDUs exchanged with card', self,
|
||||||
onchange_cb=self._onchange_apdu_trace))
|
onchange_cb=self._onchange_apdu_trace))
|
||||||
|
|
||||||
self.equip(card, rs)
|
self.equip(card, rs)
|
||||||
@@ -287,23 +287,23 @@ class PysimApp(cmd2.Cmd):
|
|||||||
sys.stderr = self._stderr_backup
|
sys.stderr = self._stderr_backup
|
||||||
|
|
||||||
def _show_failure_sign(self):
|
def _show_failure_sign(self):
|
||||||
self.poutput(style(" +-------------+", fg=fg.bright_red))
|
self.poutput(style(" +-------------+", fg=Fg.LIGHT_RED))
|
||||||
self.poutput(style(" + ## ## +", fg=fg.bright_red))
|
self.poutput(style(" + ## ## +", fg=Fg.LIGHT_RED))
|
||||||
self.poutput(style(" + ## ## +", fg=fg.bright_red))
|
self.poutput(style(" + ## ## +", fg=Fg.LIGHT_RED))
|
||||||
self.poutput(style(" + ### +", fg=fg.bright_red))
|
self.poutput(style(" + ### +", fg=Fg.LIGHT_RED))
|
||||||
self.poutput(style(" + ## ## +", fg=fg.bright_red))
|
self.poutput(style(" + ## ## +", fg=Fg.LIGHT_RED))
|
||||||
self.poutput(style(" + ## ## +", fg=fg.bright_red))
|
self.poutput(style(" + ## ## +", fg=Fg.LIGHT_RED))
|
||||||
self.poutput(style(" +-------------+", fg=fg.bright_red))
|
self.poutput(style(" +-------------+", fg=Fg.LIGHT_RED))
|
||||||
self.poutput("")
|
self.poutput("")
|
||||||
|
|
||||||
def _show_success_sign(self):
|
def _show_success_sign(self):
|
||||||
self.poutput(style(" +-------------+", fg=fg.bright_green))
|
self.poutput(style(" +-------------+", fg=Fg.LIGHT_GREEN))
|
||||||
self.poutput(style(" + ## +", fg=fg.bright_green))
|
self.poutput(style(" + ## +", fg=Fg.LIGHT_GREEN))
|
||||||
self.poutput(style(" + ## +", fg=fg.bright_green))
|
self.poutput(style(" + ## +", fg=Fg.LIGHT_GREEN))
|
||||||
self.poutput(style(" + # ## +", fg=fg.bright_green))
|
self.poutput(style(" + # ## +", fg=Fg.LIGHT_GREEN))
|
||||||
self.poutput(style(" + ## # +", fg=fg.bright_green))
|
self.poutput(style(" + ## # +", fg=Fg.LIGHT_GREEN))
|
||||||
self.poutput(style(" + ## +", fg=fg.bright_green))
|
self.poutput(style(" + ## +", fg=Fg.LIGHT_GREEN))
|
||||||
self.poutput(style(" +-------------+", fg=fg.bright_green))
|
self.poutput(style(" +-------------+", fg=Fg.LIGHT_GREEN))
|
||||||
self.poutput("")
|
self.poutput("")
|
||||||
|
|
||||||
def _process_card(self, first, script_path):
|
def _process_card(self, first, script_path):
|
||||||
|
|||||||
Reference in New Issue
Block a user