Skip to content

Commit cc5dbf9

Browse files
committed
refactor line and Var
1 parent 01967a3 commit cc5dbf9

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

  • implement-shell-tools/ls

implement-shell-tools/ls/ls.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44

55
def show_files(files, show_hidden):
66
for file in files:
7-
if show_hidden:
8-
print(file)
9-
else:
10-
if not file.startswith("."):
11-
print(file)
7+
if show_hidden or not file.startswith("."):
8+
print(file)
129

1310

1411
parser = argparse.ArgumentParser(
@@ -24,8 +21,6 @@ def show_files(files, show_hidden):
2421
args = parser.parse_args()
2522

2623

27-
fn = args.path
28-
listDir = os.listdir(fn)
24+
directory_path = args.path
25+
listDir = os.listdir(directory_path)
2926

30-
if fn != "":
31-
show_files(listDir, args.a)

0 commit comments

Comments
 (0)