Skip to content

Commit

Permalink
add the default operation of ls command.
Browse files Browse the repository at this point in the history
  • Loading branch information
liwei-lai committed Jan 20, 2013
1 parent 52f8383 commit 157380e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ Support Commands:
- ls::
Usage: ls {groups | records | `group_name` | `group_id`}

selected args:
- `group`: literal key word, show all the groups
selected args::
- single `ls` command: default to show all groups
- `groups`: literal key word, show all the groups
- `records`: literal key word, show all the records
- group_name: group name, show all the records in the specific group
- group_id: group id, show all the records in the specific group
Expand Down
10 changes: 8 additions & 2 deletions papyrus.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self):
self.cipher = ''
self.data = None
# self._records is a proxy structure mapping to the records of
# self.data and is use for better contrive records.
# self.data and is use for better retrieve records.
self._records = defaultdict(dict)

def initialize(self, cipher, filepath='records.dat'):
Expand Down Expand Up @@ -327,13 +327,19 @@ def do_ls(self, line):
Usage: ls {groups | records | `group_name` | `group_id`}
selected args::
- `group`: literal key word, show all the groups
- single `ls` command: default to show all groups
- `groups`: literal key word, show all the groups
- `records`: literal key word, show all the records
- group_name: group name, show all the records in the specific group
- group_id: group id, show all the records in the specific group
List all the groups or records existing in the current program.
"""
# single `ls` command, default to show all groups
if line == '':
self._ls_case_groups('groups')
return

args = self._validate_line(line, lengths=(1, 2), cmd='ls')
target = args[0]
if target.isdigit():
Expand Down

0 comments on commit 157380e

Please sign in to comment.