forked from photoprism/photoprism
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Michael Mayer <[email protected]>
- Loading branch information
Showing
9 changed files
with
88 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package commands | ||
|
||
import ( | ||
"github.com/urfave/cli" | ||
|
||
"github.com/photoprism/photoprism/internal/config" | ||
) | ||
|
||
// ConnectCommand configures the command name, flags, and action. | ||
var ConnectCommand = cli.Command{ | ||
Name: "connect", | ||
Usage: "Connects your membership account", | ||
ArgsUsage: "[activation code]", | ||
Action: connectAction, | ||
} | ||
|
||
// connectAction connects your membership account. | ||
func connectAction(ctx *cli.Context) error { | ||
return CallWithDependencies(ctx, func(conf *config.Config) error { | ||
token := ctx.Args().First() | ||
|
||
// Fail if no code was provided. | ||
if token == "" { | ||
return cli.ShowSubcommandHelp(ctx) | ||
} | ||
|
||
// Connect to hub. | ||
if err := conf.ResyncHub(token); err != nil { | ||
return err | ||
} | ||
|
||
log.Infof("successfully connected your account") | ||
|
||
return nil | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters