diff --git a/cmd/skillshare/collect.go b/cmd/skillshare/collect.go index 36dd24504..82f70c016 100644 --- a/cmd/skillshare/collect.go +++ b/cmd/skillshare/collect.go @@ -55,6 +55,11 @@ func displayLocalSkills(skills []sync.LocalSkillInfo) { } func cmdCollect(args []string) error { + if wantsHelp(args) { + printCollectHelp() + return nil + } + start := time.Now() mode, rest, err := parseModeArgs(args) @@ -290,3 +295,26 @@ func showCollectNextSteps(source string) { ui.Info("Commit changes: cd %s && git add . && git commit", source) } } + +func printCollectHelp() { + fmt.Println(`Usage: skillshare collect [target] [options] + +Collect local skills from target(s) to source directory. + +Arguments: + [target] Target name to collect from (optional) + +Options: + --all, -a Collect from all targets + --dry-run, -n Preview changes without applying + --force, -f Skip confirmation prompts + --json Output results as JSON + --project, -p Use project-level config + --global, -g Use global config + --help, -h Show this help + +Examples: + skillshare collect claude Collect from Claude target + skillshare collect --all Collect from all targets + skillshare collect --dry-run Preview what would be collected`) +} diff --git a/cmd/skillshare/doctor.go b/cmd/skillshare/doctor.go index 2a89f6dcd..956072a8b 100644 --- a/cmd/skillshare/doctor.go +++ b/cmd/skillshare/doctor.go @@ -48,6 +48,11 @@ func (r *doctorResult) addInfo(name, message string) { } func cmdDoctor(args []string) error { + if wantsHelp(args) { + printDoctorHelp() + return nil + } + mode, rest, err := parseModeArgs(args) if err != nil { return err @@ -1119,3 +1124,20 @@ func printUpdateAvailable(result *versioncheck.CheckResult) { ui.Info("Update available: %s -> %s", result.CurrentVersion, result.LatestVersion) ui.Info(" Run: %s", result.InstallMethod.UpgradeCommand()) } + +func printDoctorHelp() { + fmt.Println(`Usage: skillshare doctor [options] + +Check environment and diagnose issues. + +Options: + --json Output results as JSON + --project, -p Use project-level config + --global, -g Use global config + --help, -h Show this help + +Examples: + skillshare doctor Run diagnostics + skillshare doctor --json Output as JSON + skillshare doctor -p Check project config`) +} diff --git a/cmd/skillshare/json_output.go b/cmd/skillshare/json_output.go index c930b4934..190aab0d5 100644 --- a/cmd/skillshare/json_output.go +++ b/cmd/skillshare/json_output.go @@ -92,6 +92,11 @@ func hasFlag(args []string, flag string) bool { return slices.Contains(args, flag) } +// wantsHelp returns true if args contain --help or -h. +func wantsHelp(args []string) bool { + return hasFlag(args, "--help") || hasFlag(args, "-h") +} + // ensureEmptySlices recursively walks exported struct fields and replaces nil // slices with empty slices so json.Marshal produces [] instead of null. // It handles nested structs and slices of structs. diff --git a/cmd/skillshare/pull.go b/cmd/skillshare/pull.go index fae912c11..5f6bc2945 100644 --- a/cmd/skillshare/pull.go +++ b/cmd/skillshare/pull.go @@ -22,6 +22,11 @@ const ( ) func cmdPull(args []string) error { + if wantsHelp(args) { + printPullHelp() + return nil + } + start := time.Now() dryRun := false force := false @@ -248,3 +253,19 @@ func resetToRemote(sourcePath, remoteBranch string, spinner *ui.Spinner) error { } return nil } + +func printPullHelp() { + fmt.Println(`Usage: skillshare pull [options] + +Pull from git remote and sync to all targets. + +Options: + --dry-run, -n Preview changes without applying + --force, -f Force-pull (reset local to remote on first pull) + --help, -h Show this help + +Examples: + skillshare pull Pull and sync + skillshare pull --dry-run Preview what would happen + skillshare pull --force Discard local, use remote`) +} diff --git a/cmd/skillshare/push.go b/cmd/skillshare/push.go index c2358194b..a738b90f7 100644 --- a/cmd/skillshare/push.go +++ b/cmd/skillshare/push.go @@ -210,6 +210,11 @@ func detectRemoteDefaultBranchForPush(sourcePath string, authEnv []string) strin } func cmdPush(args []string) error { + if wantsHelp(args) { + printPushHelp() + return nil + } + start := time.Now() opts := parsePushArgs(args) @@ -270,3 +275,19 @@ func cmdPush(args []string) error { return nil } + +func printPushHelp() { + fmt.Println(`Usage: skillshare push [options] + +Commit and push source skills to git remote. + +Options: + -m, --message Commit message (default: "Update skills") + --dry-run, -n Preview changes without applying + --help, -h Show this help + +Examples: + skillshare push Push with default message + skillshare push -m "Add new skill" Push with custom message + skillshare push --dry-run Preview what would happen`) +} diff --git a/cmd/skillshare/status.go b/cmd/skillshare/status.go index b55de08a0..6f2e8ed60 100644 --- a/cmd/skillshare/status.go +++ b/cmd/skillshare/status.go @@ -67,6 +67,11 @@ type statusJSONAudit struct { } func cmdStatus(args []string) error { + if wantsHelp(args) { + printStatusHelp() + return nil + } + mode, rest, err := parseModeArgs(args) if err != nil { return err @@ -535,6 +540,23 @@ func fetchRemoteSkillVersion() string { return "" } +func printStatusHelp() { + fmt.Println(`Usage: skillshare status [options] + +Show status of source, skills, and all targets. + +Options: + --json Output results as JSON + --project, -p Use project-level config + --global, -g Use global config + --help, -h Show this help + +Examples: + skillshare status Show current state + skillshare status --json Output as JSON + skillshare status -p Show project status`) +} + func readSkillVersion(skillFile string) string { file, err := os.Open(skillFile) if err != nil { diff --git a/cmd/skillshare/sync.go b/cmd/skillshare/sync.go index 77309baf3..114527ce7 100644 --- a/cmd/skillshare/sync.go +++ b/cmd/skillshare/sync.go @@ -56,6 +56,11 @@ type syncModeStats struct { } func cmdSync(args []string) error { + if wantsHelp(args) { + printSyncHelp() + return nil + } + // Subcommand: sync extras if len(args) > 0 && args[0] == "extras" { return cmdSyncExtras(args[1:]) @@ -755,3 +760,27 @@ func syncSymlinkMode(name string, target config.TargetConfig, source string, dry return nil } + +func printSyncHelp() { + fmt.Println(`Usage: skillshare sync [options] + +Sync skills from source to all configured targets. + +Options: + --all Sync skills and extras + --dry-run, -n Preview changes without applying + --force, -f Force sync (overwrite local changes) + --json Output results as JSON + --project, -p Use project-level config + --global, -g Use global config + --help, -h Show this help + +Subcommands: + extras Sync only extras (see: skillshare sync extras --help) + +Examples: + skillshare sync Sync skills to all targets + skillshare sync --dry-run Preview sync changes + skillshare sync --all Sync skills and extras + skillshare sync -p Sync project-level skills`) +} diff --git a/cmd/skillshare/ui.go b/cmd/skillshare/ui.go index adf57161a..92951ec2e 100644 --- a/cmd/skillshare/ui.go +++ b/cmd/skillshare/ui.go @@ -15,6 +15,11 @@ import ( ) func cmdUI(args []string) error { + if wantsHelp(args) { + printUIHelp() + return nil + } + mode, rest, err := parseModeArgs(args) if err != nil { return err @@ -221,3 +226,26 @@ func openBrowser(url string) { } _ = cmd.Start() } + +func printUIHelp() { + fmt.Println(`Usage: skillshare ui [options] + +Launch the web dashboard. + +Options: + --port Server port (default: 19420) + --host Server host (default: 127.0.0.1) + --base-path, -b Base path prefix for reverse proxy + --no-open Don't open browser automatically + --clear-cache Clear cached UI assets and exit + --project, -p Use project-level config + --global, -g Use global config + --help, -h Show this help + +Examples: + skillshare ui Launch dashboard + skillshare ui --port 8080 Launch on custom port + skillshare ui --no-open Launch without opening browser + skillshare ui -p Launch in project mode + skillshare ui --clear-cache Clear cached UI files`) +}