diff options
-rwxr-xr-x | debdate | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -156,11 +156,18 @@ class Command: Convert Gregorian dates to Debian Regnal dates ''' ) - self.parser.add_argument( + self.date_options = self.parser.add_mutually_exclusive_group() + self.date_options.add_argument( '-d', '--date', help='A gregorian date', default='', ) + self.date_options.add_argument( + '-s', '--seconds', + help='A date as seconds from the Unix Epoch', + default=None, + type=int, + ) self.parser.set_defaults(func=self.print_date) self.subparsers = self.parser.add_subparsers() self.test_parser = self.subparsers.add_parser( @@ -176,6 +183,8 @@ class Command: def print_date(self, args): if args.date: date = parser.parse(args.date).date() + elif args.seconds: + date = datetime.date.fromtimestamp(args.seconds) else: date = datetime.date.today() debdate = DebDate() |