Skip to content

Commit 7e1ab64

Browse files
committed
Fix ZettelGeist#42: inherit counter from id by default
1 parent 859a60f commit 7e1ab64

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

zettelgeist/zettel.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@ def main():
557557
if not os.path.exists(name_dir):
558558
print("Destination directory specified (--name-dir %s) does not exist. Will not write file.")
559559
sys.exit(1)
560+
# If omitted, --counter takes on --id
561+
if args.id and not args.counter:
562+
argsd['counter'] = args.id
560563
for arg in args.name:
561564
if arg not in ['id','timestamp', 'counter']:
562565
print("--name may only use id, counter, and timestamp (%s found)" % arg)
@@ -569,11 +572,10 @@ def main():
569572
name_components['id'] = args.id
570573
digits = args.digits
571574

572-
# --counter and --id can be specified separately
573575
# If omitted, --counter takes on --id
574-
# If both are omitted, then we are not using counters in the generated names.
575-
counter_name = args.counter
576-
if not args.counter:
576+
if args.counter:
577+
counter_name = args.counter
578+
elif args.id:
577579
counter_name = args.id
578580

579581
if counter_name != None:

0 commit comments

Comments
 (0)