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

Function userCmd

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

Source from the content-addressed store, hash-verified

173}
174
175func userCmd(args []string) {
176 if len(args) < 1 {
177 fmt.Println(`Usage:
178 dnote-server user [command]
179
180Available commands:
181 create: Create a new user
182 list: List all users
183 remove: Remove a user
184 reset-password: Reset a user's password`)
185 os.Exit(1)
186 }
187
188 subcommand := args[0]
189 subArgs := []string{}
190 if len(args) > 1 {
191 subArgs = args[1:]
192 }
193
194 switch subcommand {
195 case "create":
196 userCreateCmd(subArgs)
197 case "list":
198 userListCmd(subArgs, os.Stdout)
199 case "remove":
200 userRemoveCmd(subArgs, os.Stdin)
201 case "reset-password":
202 userResetPasswordCmd(subArgs)
203 default:
204 fmt.Printf("Unknown subcommand: %s\n\n", subcommand)
205 fmt.Println(`Available commands:
206 create: Create a new user
207 list: List all users
208 remove: Remove a user (only if they have no notes or books)
209 reset-password: Reset a user's password`)
210 os.Exit(1)
211 }
212}

Callers 1

ExecuteFunction · 0.85

Calls 4

userCreateCmdFunction · 0.85
userListCmdFunction · 0.85
userRemoveCmdFunction · 0.85
userResetPasswordCmdFunction · 0.85

Tested by

no test coverage detected