gen -> newSecret

This commit is contained in:
Christine Dodrill 2015-09-21 16:59:40 -07:00
parent 1ab7cb324a
commit 979376a63e
2 changed files with 13 additions and 13 deletions

View File

@ -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"

View File

@ -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>
@ -55,9 +55,9 @@ for kind, key, val in getopt():
case key case key
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()
@ -77,9 +77,9 @@ if not existsDir(totpRoot):
echo "Created totp root " & totpRoot echo "Created totp root " & 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."
writeHelp() writeHelp()