gen -> newSecret
This commit is contained in:
parent
1ab7cb324a
commit
979376a63e
|
@ -7,20 +7,20 @@ import random
|
|||
import strutils
|
||||
import uri
|
||||
|
||||
const genUsage =
|
||||
"""Usage: totptool gen <name>
|
||||
const newSecretUsage =
|
||||
"""Usage: totptool newSecret <name>
|
||||
|
||||
This will generate a new secret and recovery codes
|
||||
This will newSecreterate a new secret and recovery codes
|
||||
for a given service name. This will then write it
|
||||
to your configured secret store and make it
|
||||
available for `totptool code` instantly.
|
||||
"""
|
||||
|
||||
proc help*() =
|
||||
echo genUsage
|
||||
echo newSecretUsage
|
||||
quit 2
|
||||
|
||||
proc gen*(root: string, args: seq[string]) =
|
||||
proc newSecret*(root: string, args: seq[string]) =
|
||||
if args.len != 1:
|
||||
quit "I need a machine name"
|
||||
|
16
totptool.nim
16
totptool.nim
|
@ -3,7 +3,7 @@ import parseopt2
|
|||
|
||||
# Subcommands
|
||||
import cmds/code
|
||||
import cmds/gen
|
||||
import cmds/newSecret
|
||||
import cmds/ls
|
||||
|
||||
const usageHelp =
|
||||
|
@ -18,7 +18,7 @@ Subcommands:
|
|||
code <name>
|
||||
Generate a two-factor auth code for <name>
|
||||
|
||||
gen <name>
|
||||
newSecret <name>
|
||||
Generate a new two-factor auth secret for
|
||||
<name>
|
||||
|
||||
|
@ -55,9 +55,9 @@ for kind, key, val in getopt():
|
|||
case key
|
||||
of "help", "h":
|
||||
case command
|
||||
of "code": code.help()
|
||||
of "gen": gen.help()
|
||||
of "ls": ls.help()
|
||||
of "code": code.help()
|
||||
of "newSecretSecret": newSecret.help()
|
||||
of "ls": ls.help()
|
||||
else:
|
||||
writeHelp()
|
||||
|
||||
|
@ -77,9 +77,9 @@ if not existsDir(totpRoot):
|
|||
echo "Created totp root " & totpRoot
|
||||
|
||||
case command
|
||||
of "code": code totpRoot, args
|
||||
of "gen": gen totpRoot, args
|
||||
of "ls": ls totpRoot, args
|
||||
of "code": code totpRoot, args
|
||||
of "newSecretSecret": newSecret totpRoot, args
|
||||
of "ls": ls totpRoot, args
|
||||
else:
|
||||
echo "Command " & command & " not found."
|
||||
writeHelp()
|
||||
|
|
Loading…
Reference in New Issue