fix readability with the one line

This commit is contained in:
stephentoth 2024-03-05 20:58:52 -06:00
parent 497686d3b1
commit 991a5c01b0
1 changed files with 10 additions and 1 deletions

11
ls.py
View File

@ -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")