MCPcopy
hub / github.com/dnote/dnote / NewCmd

Function NewCmd

pkg/cli/cmd/login/login.go:40–54  ·  view source on GitHub ↗

NewCmd returns a new login command

(ctx context.DnoteCtx)

Source from the content-addressed store, hash-verified

38
39// NewCmd returns a new login command
40func NewCmd(ctx context.DnoteCtx) *cobra.Command {
41 cmd := &cobra.Command{
42 Use: "login",
43 Short: "Login to dnote server",
44 Example: example,
45 RunE: newRun(ctx),
46 }
47
48 f := cmd.Flags()
49 f.StringVarP(&usernameFlag, "username", "u", "", "email address for authentication")
50 f.StringVarP(&passwordFlag, "password", "p", "", "password for authentication")
51 f.StringVar(&apiEndpointFlag, "apiEndpoint", "", "API endpoint to connect to (defaults to value in config)")
52
53 return cmd
54}
55
56// Do dervies credentials on the client side and requests a session token from the server
57func Do(ctx context.DnoteCtx, email, password string) error {

Callers 1

mainFunction · 0.92

Calls 1

newRunFunction · 0.70

Tested by

no test coverage detected