[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Duplicity-talk] parser.add_option --time-format [SEC=UNCLASSIFIED]
From: |
Peter . Hine |
Subject: |
Re: [Duplicity-talk] parser.add_option --time-format [SEC=UNCLASSIFIED] |
Date: |
Fri, 28 Aug 2015 13:23:01 +1000 |
oops
parser.add_option("--time-format", type="string", dest="time_format")
thanks
Peter Hine
Senior Technical Support Engineer (Servers)
FCoA ITS
address@hidden
From: address@hidden
To: "Discussion of the backup program duplicity"
<address@hidden>
Date: 28/08/2015 13:07
Subject: [Duplicity-talk] parser.add_option --time-format
[SEC=UNCLASSIFIED]
Sent by: address@hidden
I'm just playing at the moment, learning things.
In global.py, i've added the following line after time_separator
time_format = "%a %b %d %H" + time_separator + "%M" + time_separator + "%S
%Y"
and in dup_time.py, changed timetopretty
from :
def timetopretty(timeinseconds):
"""Return pretty version of time"""
return time.asctime(time.localtime(timeinseconds))
to :
def timetopretty(timeinseconds):
"""Return pretty version of time"""
#return time.asctime(time.localtime(timeinseconds))
return time.strftime(globals.time_format, time.localtime
(timeinseconds))
this effectively moves the formatting over to the variable : "time_format"
altering the value in globals.py for time_format and rerunning
collection-status; it can be shown that the variable time_format is
working.
#########################
So the actual question, how do i get it to be a command line option
(disregarding the config file option for the moment)
I've tried a few things, but i really don't know what i'm doing with python
parser.add_option("--time-format", action="store_const", const=str,
dest="time-format")
yields the error "Command line error: Expected 1 args, got 2" when i used
--time-format '%Y %b %d %H:%M:%S' or "%Y %b %d %H:%M:%S" or "
%Y:%b:%d:%H:%M:%S"
the second argument appears to be the "target_url" as the following seems
to imply
duplicity --time-format '%Y:%b:%d:%H:%M:%S' collection-status
scp://address@hidden:54321//backup/
Command line error: Expected 2 args, got 3
thanks
Peter Hine
Senior Technical Support Engineer (Servers)
FCoA ITS
address@hidden
**********************************************************************
The information contained in this e-mail (including any attachments)
is for the exclusive use of the addressee. If you are not the intended
recipient please notify the sender immediately and delete this e-mail.
It is noted that legal privilege is not waived because you have read
this e-mail.
**********************************************************************
_______________________________________________
Duplicity-talk mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/duplicity-talk