Skip to content

Commit

Permalink
Fix ZettelGeist#42: inherit counter from id by default
Browse files Browse the repository at this point in the history
  • Loading branch information
icornelius committed Aug 25, 2024
1 parent 859a60f commit 7e1ab64
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions zettelgeist/zettel.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,9 @@ def main():
if not os.path.exists(name_dir):
print("Destination directory specified (--name-dir %s) does not exist. Will not write file.")
sys.exit(1)
# If omitted, --counter takes on --id
if args.id and not args.counter:
argsd['counter'] = args.id
for arg in args.name:
if arg not in ['id','timestamp', 'counter']:
print("--name may only use id, counter, and timestamp (%s found)" % arg)
Expand All @@ -569,11 +572,10 @@ def main():
name_components['id'] = args.id
digits = args.digits

# --counter and --id can be specified separately
# If omitted, --counter takes on --id
# If both are omitted, then we are not using counters in the generated names.
counter_name = args.counter
if not args.counter:
if args.counter:
counter_name = args.counter
elif args.id:
counter_name = args.id

if counter_name != None:
Expand Down

0 comments on commit 7e1ab64

Please sign in to comment.