print full urls

This commit is contained in:
Ville Rantanen
2020-06-12 13:14:20 +03:00
parent 327623dcbe
commit c0f07d75a6
2 changed files with 14 additions and 9 deletions

5
flit
View File

@@ -1,5 +0,0 @@
#!/bin/bash
cd $( dirname $( readlink -f $0 ) )
python3 flit.py "$@"

18
flit.py
View File

@@ -33,6 +33,14 @@ def parse_opts():
action = _HelpAction,
help = 'Show this help message and exit'
)
parser.add_argument(
'--root', '-r',
action = "store",
dest = "root",
type = str,
default = "",
help = 'Root address for printing URLS'
)
subparsers = parser.add_subparsers(
dest="command",
@@ -96,14 +104,15 @@ def get_folder_names():
return [p[0] for p in dir_list]
def list_folders():
def list_folders(root_folder):
names = get_folder_names()
print("Folder Created ToDelete InDays")
for p in names:
stats = get_stats(p)
sub_files = get_sub_files(p)
due = "*" if stats[3] else ""
print("{}/ {} {} {: 3d}d{}".format(
print("{}/{}/ {} {} {: 3d}d{}".format(
root_folder,
p,
stats[0].isoformat()[0:10],
stats[1].isoformat()[0:10],
@@ -111,7 +120,7 @@ def list_folders():
due
))
for sp in sub_files:
print(" {}".format(sp))
print(" {}/{}/{}".format(root_folder,p,sp))
#print(p, stats, sub_files)
@@ -134,9 +143,10 @@ if __name__ == '__main__':
new_name = random_name()
create_new(new_name, opts.days)
print(os.path.abspath(new_name))
print(opts.root + "/" + new_name)
if opts.command == "list" or opts.command == None:
list_folders()
list_folders(opts.root)
if opts.command == "del":
del_due_folders()