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 fc93e92 commit 3d571ebCopy full SHA for 3d571eb
1 file changed
implement-shell-tools/ls/ls.py
@@ -0,0 +1,18 @@
1
+import os
2
+import argparse
3
+
4
+parser=argparse.ArgumentParser(prog="cat",usage="implement a simple ls python")
5
+parser.add_argument("-1",dest="one",action="store_true")
6
+parser.add_argument("-a",action="store_true")
7
+parser.add_argument("path",nargs="*",help="path to list files")
8
+args=parser.parse_args()
9
10
+paths=args.path
11
+if len(paths)==0 : paths=["."]
12
13
+for path in paths :
14
+ files_list=os.listdir(path)
15
+ files_list.sort(key=str.lower)
16
+if args.one :
17
+ for item in files_list :
18
+ print(item)
0 commit comments