MCPcopy Index your code
hub / github.com/dnote/dnote / userCreateCmd

Function userCreateCmd

pkg/server/cmd/user.go:42–65  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

40}
41
42func userCreateCmd(args []string) {
43 fs := setupFlagSet("create", "dnote-server user create")
44
45 email := fs.String("email", "", "User email address (required)")
46 password := fs.String("password", "", "User password (required)")
47 dbPath := fs.String("dbPath", "", "Path to SQLite database file (env: DBPath, default: $XDG_DATA_HOME/dnote/server.db)")
48
49 fs.Parse(args)
50
51 requireString(fs, *email, "email")
52 requireString(fs, *password, "password")
53
54 a, cleanup := createApp(fs, *dbPath)
55 defer cleanup()
56
57 _, err := a.CreateUser(*email, *password, *password)
58 if err != nil {
59 log.ErrorWrap(err, "creating user")
60 os.Exit(1)
61 }
62
63 fmt.Printf("User created successfully\n")
64 fmt.Printf("Email: %s\n", *email)
65}
66
67func userRemoveCmd(args []string, stdin io.Reader) {
68 fs := setupFlagSet("remove", "dnote-server user remove")

Callers 2

TestUserCreateCmdFunction · 0.85
userCmdFunction · 0.85

Calls 5

ErrorWrapFunction · 0.92
setupFlagSetFunction · 0.85
requireStringFunction · 0.85
createAppFunction · 0.85
CreateUserMethod · 0.80

Tested by 1

TestUserCreateCmdFunction · 0.68