add compress or not option, enhance help
This commit is contained in:
parent
2f7098a866
commit
0495668fc9
1 changed files with 38 additions and 22 deletions
30
workdirfs.py
30
workdirfs.py
|
@ -173,6 +173,7 @@ class WorkdirFS(Operations):
|
|||
print("Directory is empty -> remove it",
|
||||
os.path.join(root, d))
|
||||
os.remove(os.path.join(root, d))
|
||||
if self.args.compress:
|
||||
for f in files:
|
||||
print("compress", os.path.join(root, f))
|
||||
if zip_fileext not in f:
|
||||
|
@ -324,16 +325,31 @@ if __name__ == '__main__':
|
|||
#main(sys.argv[2], sys.argv[1])
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-a", "--archive",
|
||||
default='archive/workdir', help="Path to archivedir-base")
|
||||
default='archive/workdir', help="""Path to archivedir-base. When path
|
||||
starts with "/", it's an absolute path, else it is handled as path
|
||||
relative to users home.
|
||||
Defaults to »archive/workdir« """)
|
||||
parser.add_argument("-m", "--mountpoint",
|
||||
default='Work', help='Path to Workdir')
|
||||
parser.add_argument("-t", "--timeoffset", type=int, default=2, help="""If you're working
|
||||
default='Work', help="""Path to Workdir. This path is always
|
||||
relative to users homedir. "/" at the begin get removed.
|
||||
Defaults to »Work«""")
|
||||
parser.add_argument("-t", "--timeoffset", type=int, default=4, help="""If you're working
|
||||
all day till 3 o'clock in the morning, set it to 4, so next day
|
||||
archive-dir will be created 4 hours after midnight. You have 1h
|
||||
tolerance, if you're working one day a little bit longer""")
|
||||
parser.add_argument("-Y", "--yearlydir", action="store_true")
|
||||
parser.add_argument("-M", "--monthlydir", action="store_true")
|
||||
parser.add_argument("-W", "--weeklydir", action="store_true")
|
||||
tolerance, if you're working one day a little bit longer.
|
||||
Defaults to »4«""")
|
||||
parser.add_argument("-Y", "--yearlydir", action="store_true",
|
||||
help="""Create a yearly directory - named YYYY - under »archive«.
|
||||
Defaults to »False«""")
|
||||
parser.add_argument("-M", "--monthlydir", action="store_true",
|
||||
help="""Create a monthly directory - named MM - under »archive«.
|
||||
Defaults to »False«""")
|
||||
parser.add_argument("-W", "--weeklydir", action="store_true",
|
||||
help="""Create a weekly directory - named WW - under »archive«.
|
||||
Defaults to »False«""")
|
||||
parser.add_argument("-C", "--compress", action="store_false",
|
||||
help="""Compress each file in archive
|
||||
Defaults to »True«""")
|
||||
args = parser.parse_args()
|
||||
print(args)
|
||||
#root = os.environ['HOME']+'/archive'
|
||||
|
|
Loading…
Reference in a new issue