fixes
This commit is contained in:
@@ -32,7 +32,8 @@ func (p *LoginCmd) SetFlags(f *flag.FlagSet) {
|
|||||||
|
|
||||||
func (p *LoginCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
func (p *LoginCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
||||||
if f.NArg() != 1 {
|
if f.NArg() != 1 {
|
||||||
fmt.Fprintf(os.Stderr, "error: this command take 1 argument")
|
fmt.Fprintln(os.Stderr, "error: this command take 1 argument")
|
||||||
|
|
||||||
return subcommands.ExitUsageError
|
return subcommands.ExitUsageError
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,12 +47,12 @@ func (p *LoginCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
|
|||||||
|
|
||||||
cli := client.New(server, username, password)
|
cli := client.New(server, username, password)
|
||||||
if _, err := cli.Version(); err != nil {
|
if _, err := cli.Version(); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "error: failed to login: %s", err)
|
fmt.Fprintf(os.Stderr, "error: failed to login: %s\n", err)
|
||||||
return subcommands.ExitFailure
|
return subcommands.ExitFailure
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := credentials.Login(username, password, server); err != nil {
|
if err := credentials.Login(username, password, server); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "error: failed to save login: %s", err)
|
fmt.Fprintf(os.Stderr, "error: failed to save login: %s\n", err)
|
||||||
return subcommands.ExitFailure
|
return subcommands.ExitFailure
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ func (*RemoteCmd) Usage() string {
|
|||||||
|
|
||||||
The -list argument lists all remotes for each registered game.
|
The -list argument lists all remotes for each registered game.
|
||||||
This command performs a connection test.
|
This command performs a connection test.
|
||||||
|
Usage: cloudsave remote -list
|
||||||
|
|
||||||
The -set argument allow you to set (create or update)
|
The -set argument allow you to set (create or update)
|
||||||
the URL to the remote for a game
|
the URL to the remote for a game
|
||||||
|
Usage: cloudsave remote -set GAME_ID REMOTE_URL
|
||||||
|
|
||||||
Options
|
Options
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -30,6 +30,14 @@ func run(updateChan <-chan struct{}) {
|
|||||||
slog.SetLogLoggerLevel(slog.LevelDebug)
|
slog.SetLogLoggerLevel(slog.LevelDebug)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !filepath.IsAbs(documentRoot) {
|
||||||
|
if v, err := filepath.Abs(documentRoot); err == nil {
|
||||||
|
documentRoot = v
|
||||||
|
} else {
|
||||||
|
fatal("failed to get absolute path from document-root flag: "+err.Error(), 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
slog.Info("loading .htpasswd")
|
slog.Info("loading .htpasswd")
|
||||||
h, err := htpasswd.Open(filepath.Join(documentRoot, ".htpasswd"))
|
h, err := htpasswd.Open(filepath.Join(documentRoot, ".htpasswd"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user