Skip to content

Commit b381274

Browse files
committed
Handle -1 flag explicitly and sort file listing
1 parent f2ad18a commit b381274

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • implement-shell-tools/ls

implement-shell-tools/ls/ls.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
args = sys.argv[1:]
55

66
show_all = False
7+
one_per_line = False
78
path = "."
89

910
for arg in args:
10-
1111
if arg == "-a":
1212
show_all = True
13-
14-
elif arg != "-1":
13+
elif arg == "-1":
14+
one_per_line = True
15+
else:
1516
path = arg
1617

17-
files = os.listdir(path)
18+
files = sorted(os.listdir(path))
1819

1920
for file in files:
20-
2121
if not show_all and file.startswith("."):
2222
continue
2323

0 commit comments

Comments
 (0)