Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ func init() {
"pin this profile to the current directory tree (writes <cwd>/.praxis) and install its skills project-scoped, instead of switching the global profile")
loginCmd.Flags().BoolVar(&loginJSON, "json", false, "JSON output")
loginCmd.Flags().DurationVar(&loginTimeout, "timeout", 90*time.Second, "max time to wait for browser callback")
// No backticks in this usage string: pflag's UnquoteUsage treats a
// backticked phrase as the flag's value placeholder, which mangled the
// help table into `--raptor-profile praxis status`.
loginCmd.Flags().StringVar(&loginRaptorProfile, "raptor-profile", "",
"pair this praxis profile with a raptor profile (~/.facets/credentials section); `praxis status` then reports raptor via that profile and AI hosts prefix raptor commands with FACETS_PROFILE=<name>")
"pair this praxis profile with a raptor profile (a ~/.facets/credentials section); 'praxis status' then reports raptor via that profile and AI hosts prefix raptor commands with FACETS_PROFILE=<name>")
rootCmd.AddCommand(loginCmd)
}

Expand Down
17 changes: 17 additions & 0 deletions cmd/login_raptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/Facets-cloud/praxis-cli/internal/credentials"
"github.com/spf13/pflag"
)

// seedRaptorCreds writes a raptor-style ~/.facets/credentials into the
Expand Down Expand Up @@ -120,3 +121,19 @@ func TestResolveRaptorPairing_NoFlagNoProfile(t *testing.T) {
t.Errorf("resolveRaptorPairing() with nothing stored = %q, want empty", got)
}
}

func TestLoginFlags_HelpRendersProperTypes(t *testing.T) {
// pflag treats a backticked phrase inside a usage string as the flag's
// value placeholder — a stray backtick renders nonsense like
// `--raptor-profile praxis status` in the help table (cf. issue #66's
// missing-flag confusion). Every string flag must present as `string`.
for _, name := range []string{"profile", "url", "token", "raptor-profile"} {
f := loginCmd.Flags().Lookup(name)
if f == nil {
t.Fatalf("flag --%s not registered", name)
}
if placeholder, _ := pflag.UnquoteUsage(f); placeholder != "string" {
t.Errorf("--%s help placeholder = %q, want %q (backtick in usage string?)", name, placeholder, "string")
}
}
}