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 b3faa6b commit 4ee9b6fCopy full SHA for 4ee9b6f
1 file changed
implement-shell-tools/ls/ls.py
@@ -10,6 +10,7 @@
10
help="list one file per line")
11
12
parser.add_argument("-a",
13
+ dest="show_hidden_files",
14
action="store_true",
15
help="show hidden files")
16
@@ -18,3 +19,15 @@
18
19
default=".")
20
21
args = parser.parse_args()
22
+
23
+entries = os.listdir(args.filepath)
24
25
+if not args.show_hidden_files:
26
+ entries = [entry for entry in entries if not entry.startswith(".")]
27
28
+if args.one_per_line:
29
+ for entry in entries:
30
+ print(entry)
31
+else:
32
+ joined = "\t".join(entries)
33
+ print(joined)
0 commit comments