add example, fix issue with registry flag
Signed-off-by: Kai Xia <kaix+github@fastmail.com>
This commit is contained in:
parent
b2c03a4b0c
commit
c43ca9225f
1 changed files with 20 additions and 2 deletions
|
|
@ -49,6 +49,12 @@ func newSkillsCmd() *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "skills",
|
Use: "skills",
|
||||||
Short: "Manage skills (install, list, remove)",
|
Short: "Manage skills (install, list, remove)",
|
||||||
|
Example: ` picoclaw skills list
|
||||||
|
picoclaw skills install sipeed/picoclaw-skills/weather
|
||||||
|
picoclaw skills install --registry clawhub github
|
||||||
|
picoclaw skills install-builtin
|
||||||
|
picoclaw skills list-builtin
|
||||||
|
picoclaw skills remove weather`,
|
||||||
}
|
}
|
||||||
cmd.AddCommand(
|
cmd.AddCommand(
|
||||||
newSkillsListCmd(),
|
newSkillsListCmd(),
|
||||||
|
|
@ -74,6 +80,8 @@ func newSkillsInstallCmd() *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "install <repo>",
|
Use: "install <repo>",
|
||||||
Short: "Install skill from GitHub",
|
Short: "Install skill from GitHub",
|
||||||
|
Example: ` picoclaw skills install sipeed/picoclaw-skills/weather
|
||||||
|
picoclaw skills install --registry clawhub github`,
|
||||||
Args: cobra.MinimumNArgs(1),
|
Args: cobra.MinimumNArgs(1),
|
||||||
RunE: runSkillsInstall,
|
RunE: runSkillsInstall,
|
||||||
}
|
}
|
||||||
|
|
@ -87,6 +95,8 @@ func newSkillsRemoveCmd() *cobra.Command {
|
||||||
Use: "remove <name>",
|
Use: "remove <name>",
|
||||||
Aliases: []string{"uninstall"},
|
Aliases: []string{"uninstall"},
|
||||||
Short: "Remove installed skill",
|
Short: "Remove installed skill",
|
||||||
|
Example: ` picoclaw skills remove weather
|
||||||
|
picoclaw skills uninstall weather`,
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
RunE: runSkillsRemove,
|
RunE: runSkillsRemove,
|
||||||
}
|
}
|
||||||
|
|
@ -96,6 +106,7 @@ func newSkillsInstallBuiltinCmd() *cobra.Command {
|
||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
Use: "install-builtin",
|
Use: "install-builtin",
|
||||||
Short: "Install all builtin skills to workspace",
|
Short: "Install all builtin skills to workspace",
|
||||||
|
Example: ` picoclaw skills install-builtin`,
|
||||||
RunE: runSkillsInstallBuiltin,
|
RunE: runSkillsInstallBuiltin,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -104,6 +115,7 @@ func newSkillsListBuiltinCmd() *cobra.Command {
|
||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
Use: "list-builtin",
|
Use: "list-builtin",
|
||||||
Short: "List available builtin skills",
|
Short: "List available builtin skills",
|
||||||
|
Example: ` picoclaw skills list-builtin`,
|
||||||
RunE: runSkillsListBuiltin,
|
RunE: runSkillsListBuiltin,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -120,6 +132,7 @@ func newSkillsShowCmd() *cobra.Command {
|
||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
Use: "show <name>",
|
Use: "show <name>",
|
||||||
Short: "Show skill details",
|
Short: "Show skill details",
|
||||||
|
Example: ` picoclaw skills show weather`,
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
RunE: runSkillsShow,
|
RunE: runSkillsShow,
|
||||||
}
|
}
|
||||||
|
|
@ -160,16 +173,21 @@ func runSkillsInstall(cmd *cobra.Command, args []string) error {
|
||||||
// Check for --registry flag
|
// Check for --registry flag
|
||||||
registry, _ := cmd.Flags().GetString("registry")
|
registry, _ := cmd.Flags().GetString("registry")
|
||||||
if registry != "" {
|
if registry != "" {
|
||||||
if len(args) < 2 {
|
if len(args) < 1 {
|
||||||
fmt.Println("Usage: picoclaw skills install --registry <name> <slug>")
|
fmt.Println("Usage: picoclaw skills install --registry <name> <slug>")
|
||||||
fmt.Println("Example: picoclaw skills install --registry clawhub github")
|
fmt.Println("Example: picoclaw skills install --registry clawhub github")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
slug := args[1]
|
slug := args[0]
|
||||||
return skillsInstallFromRegistry(sc.cfg, registry, slug)
|
return skillsInstallFromRegistry(sc.cfg, registry, slug)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default: install from GitHub
|
// Default: install from GitHub
|
||||||
|
if len(args) < 1 {
|
||||||
|
fmt.Println("Usage: picoclaw skills install <github-repo>")
|
||||||
|
fmt.Println(" picoclaw skills install --registry <name> <slug>")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
repo := args[0]
|
repo := args[0]
|
||||||
fmt.Printf("Installing skill from %s...\n", repo)
|
fmt.Printf("Installing skill from %s...\n", repo)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue