File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010parser .add_argument ("-l" , "--longList" , action = "store_true" , help = "Long listing format" )
1111parser .add_argument ("-a" , "--all" , action = "store_true" , help = "Include hidden files" )
1212
13+ parser .add_argument ("-1" , "--singleColumn" , action = "store_true" , help = "List one file per line" )
1314args = parser .parse_args ()
1415
1516file_paths = args .paths
1617show_long = args .longList
1718show_all = args .all
19+ force_single_column = args .singleColumn
1820
1921def format_permissions (mode ):
2022 return stat .filemode (mode )
@@ -38,6 +40,9 @@ def format_permissions(mode):
3840 if not show_all :
3941 entries = [e for e in entries if not e .startswith ("." )]
4042
43+ # Optional: sort entries for consistent output
44+ entries .sort () # (optional for predictable output)
45+
4146 for entry in entries :
4247 full_path = os .path .join (input_path , entry )
4348 entry_stat = os .stat (full_path )
@@ -46,7 +51,7 @@ def format_permissions(mode):
4651 size = str (entry_stat .st_size ).rjust (6 )
4752 print (f"{ perms } { size } { entry } " )
4853 else :
49- print (entry )
54+ print (entry )
5055
5156 except Exception as e :
5257 print (f'Error reading "{ input_path } ": { e } ' , file = sys .stderr )
You can’t perform that action at this time.
0 commit comments