Sort results of ls by default

and replace option -s by option -U (same than the real ls command)
refs #1079
This commit is contained in:
Florent 2013-12-17 15:20:49 +01:00
commit 105ec527b5
2 changed files with 7 additions and 7 deletions

View file

@ -241,10 +241,10 @@ class Boobank(ReplApplication):
def do_list(self, line): def do_list(self, line):
""" """
list [-s] list [-U]
List accounts. List accounts.
Use -s option to display accounts in alphabetical order. Use -U to disable sorting of results.
""" """
return self.do_ls(line) return self.do_ls(line)

View file

@ -954,20 +954,20 @@ class ReplApplication(Cmd, ConsoleApplication):
def do_ls(self, line): def do_ls(self, line):
""" """
ls [-d] [-s] [PATH] ls [-d] [-U] [PATH]
List objects in current path. List objects in current path.
If an argument is given, list the specified path. If an argument is given, list the specified path.
Use -s option to sort deterministic sort of results. Use -U option to not sort results.
""" """
# TODO: real parsing of options # TODO: real parsing of options
path = line.strip() path = line.strip()
only = False only = False
sort = False sort = True
if '-s' in line.strip().partition(' '): if '-U' in line.strip().partition(' '):
path = line.strip().partition(' ')[-1] path = line.strip().partition(' ')[-1]
sort = True sort = False
if '-d' in line.strip().partition(' '): if '-d' in line.strip().partition(' '):
path = None path = None