mirror of
https://github.com/langgenius/dify-plugin-daemon.git
synced 2026-07-22 09:45:27 -04:00
dc53c0b3e3
- Introduced a new `env` command that outputs the necessary shell command to add the current working directory to the user's PATH. - Updated the `runInit` function to inform users about the new `env` command for adding tools to PATH. This update enhances the CLI by providing users with a convenient way to configure their environment for tool usage.
25 lines
455 B
Go
25 lines
455 B
Go
package command
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var EnvCmd = &cobra.Command{
|
|
Use: "env",
|
|
Short: "Output shell commands to add tools to PATH",
|
|
Long: `Output export command for eval. Usage: eval "$(dify env)"`,
|
|
Run: runEnv,
|
|
}
|
|
|
|
func runEnv(cmd *cobra.Command, args []string) {
|
|
dir, err := os.Getwd()
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
fmt.Printf("export PATH=\"%s:$PATH\"\n", dir)
|
|
}
|