Skip to content

Commit db7c86a

Browse files
committed
small changes
1 parent ad6883f commit db7c86a

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

implement-shell-tools/ls/my-ls.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,24 @@ def main():
2626
had_error = False
2727

2828
for path in paths:
29-
if list_dir(path, show_all, one_per_line):
29+
if list_dir(
30+
path,
31+
show_all=show_all,
32+
one_per_line=one_per_line,
33+
):
3034
had_error = True
3135

3236
if had_error:
3337
sys.exit(1)
3438

3539

36-
def list_dir(path, show_all=False, one_per_line = False):
40+
def list_dir(path, show_all=False, one_per_line=False):
3741
try:
3842
entries = os.listdir(path)
3943
except FileNotFoundError:
40-
print(f"ls: cannot access '{path}': No such file or directory", file=sys.stderr)
44+
print(f"ls: cannot access '{path}': No such file or directory",
45+
file=sys.stderr,
46+
)
4147
return True
4248

4349
entries = sorted(entries)
@@ -53,7 +59,7 @@ def list_dir(path, show_all=False, one_per_line = False):
5359
for entry in entries:
5460
print(entry)
5561

56-
62+
return False
5763

5864
if __name__ == "__main__":
5965
main()

0 commit comments

Comments
 (0)