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