fix readability with the one line
This commit is contained in:
parent
497686d3b1
commit
991a5c01b0
11
ls.py
11
ls.py
|
|
@ -134,6 +134,12 @@ def git_gud(path):
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def list_files(directory='.', args={}):
|
||||
filenames = os.listdir(directory)
|
||||
|
||||
|
|
@ -201,7 +207,7 @@ def list_files(directory='.', args={}):
|
|||
#mtime = time.strftime("%b %d %X %Z", time.localtime(stats.st_mtime)) # CST
|
||||
|
||||
colored_file = gen_color_file_string(file["abs_file_path"], file["stats"].st_mode)
|
||||
gitstat = (args.extend and is_path_git_repo_dir(file["abs_file_path"], file["stats"].st_mode) and git_gud(file["abs_file_path"])) or ''
|
||||
gitstat = git_gud(file["abs_file_path"]) if (args.extend and is_path_git_repo_dir(file["abs_file_path"], file["stats"].st_mode)) else ''
|
||||
|
||||
## do printing
|
||||
print(f"{perm_prettybits} {nlinks:2d} {user:<8s} {group:<8s} {size:>{longest_size_length}} {timestring} {colored_file} {gitstat}")
|
||||
|
|
@ -212,6 +218,9 @@ def list_files(directory='.', args={}):
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="List files in a directory", add_help=False)
|
||||
parser.add_argument('directory', nargs='?', default='.', help="Directory path")
|
||||
|
|
|
|||
Loading…
Reference in New Issue