We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 21c46a6 commit 2bcbf2fCopy full SHA for 2bcbf2f
1 file changed
implement-shell-tools/ls/ls.py
@@ -1,4 +1,5 @@
1
import argparse
2
+from os import listdir
3
4
parser = argparse.ArgumentParser(prog="ls", description="List directory contents. Ignore files and directories starting with a '.' by default")
5
parser.add_argument("-1", help="List one file per line.", action="store_true")
@@ -7,3 +8,16 @@
7
8
9
args = parser.parse_args()
10
11
+path = args.path
12
+
13
+show_hidden = args.a
14
15
+contents = []
16
17
+for f in listdir(path):
18
+ if show_hidden == False and f[0] != ".":
19
+ contents.append(f)
20
+ if show_hidden == True:
21
22
23
+print(contents)
0 commit comments