feat(upload): add first prototype of File storage, svg database and svg processing. Also added --help command
All checks were successful
build / Go-Build (push) Successful in 1m5s
All checks were successful
build / Go-Build (push) Successful in 1m5s
This commit is contained in:
34
internal/command/tokencommands.go
Normal file
34
internal/command/tokencommands.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
|
||||
"tomatentum.net/svg-templater/pkg/auth"
|
||||
)
|
||||
|
||||
func GenerateTokenCommand() {
|
||||
name := flag.Arg(0)
|
||||
if name == "" {
|
||||
log.Fatal("No Token Name was provided!")
|
||||
}
|
||||
|
||||
token, err := auth.CreateToken(name)
|
||||
if err != nil {
|
||||
log.Fatal("Failed to generate token:\n", err)
|
||||
}
|
||||
log.Println(token)
|
||||
}
|
||||
|
||||
func DeleteTokenCommand() {
|
||||
name := flag.Arg(0)
|
||||
if name == "" {
|
||||
log.Fatal("No Token Name was provided!")
|
||||
}
|
||||
|
||||
err := auth.DeleteToken(name)
|
||||
if err != nil {
|
||||
log.Fatal("Failed to delete token:\n", err)
|
||||
}
|
||||
log.Println("Deleted token " + name)
|
||||
}
|
||||
Reference in New Issue
Block a user