Skip to content

Commit e862624

Browse files
committed
Add basic ls -1 functionality
1 parent d5912a7 commit e862624

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

  • implement-shell-tools/ls

implement-shell-tools/ls/ls.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import sys
2+
import os
3+
4+
args = sys.argv[1:]
5+
6+
# default folder = current folder
7+
path = "."
8+
9+
# if user gives a folder
10+
if len(args) > 1:
11+
path = args[1]
12+
13+
files = os.listdir(path)
14+
15+
for file in files:
16+
print(file)

0 commit comments

Comments
 (0)