@@ -2,40 +2,52 @@ package main
2
2
3
3
import (
4
4
"fmt"
5
+
6
+ goprompt "github.com/NonLogicalDev/shell.async-goprompt"
5
7
"github.com/spf13/cobra"
6
8
)
7
9
10
+ var installDesc = `
11
+ To install run the following:
12
+
13
+ $ goprompt install zsh.zshrc >> .zshrc
14
+
15
+ FILE options:
16
+
17
+ * zsh.zshrc
18
+ * zsh.plugin
19
+ `
20
+
8
21
var (
9
22
cmdInstall = & cobra.Command {
10
- Use : "install" ,
23
+ Use : "install [FILE] " ,
11
24
Short : "install the integration" ,
25
+ Long : trim (installDesc ),
26
+ Args : cobra .MinimumNArgs (1 ),
12
27
}
13
28
)
14
29
30
+ const (
31
+ _zshRc = "zshrc"
32
+ _zshPlugin = "zshplugin"
33
+ )
34
+
15
35
func init () {
16
36
cmdInstall .RunE = cmdInstallRun
17
37
}
18
38
19
39
// TODO: bundle in the plugin directory, and provide a way to extract it into users directory of choice.
20
40
21
41
func cmdInstallRun (command * cobra.Command , args []string ) error {
22
- fmt .Println (`
23
- # SETUP:
24
- # ------------------------------------------------------------------------------
25
- # Assuming GoPrompt is installed in $(USR_BIN_DIR)
26
- # and zsh func in $(USR_ZSH_DIR)
27
- # ------------------------------------------------------------------------------
28
- # $$ make setup >> ~/.zshrc"
29
- # ------------------------------------------------------------------------------
30
- # Add this to your ~/.zshenv
31
- # ------------------------------------------------------------------------------
32
-
33
- # PROMPT_ASYNC_ZLE: ------------------------------------------------------------
34
- path+=( "$(USR_BIN_DIR)" )
35
- fpath+=( "$(USR_ZSH_DIR)" )
36
- autoload -Uz promptinit
37
- promptinit && prompt_asynczle_setup
38
- # ------------------------------------------------------------------------------
39
- ` )
42
+ var content string
43
+ switch args [0 ] {
44
+ case "zsh.zshrc" :
45
+ f , _ := goprompt .ZSHPluginFiles .ReadFile ("plugin/zsh/prompt_install.zsh" )
46
+ content = string (f )
47
+ case "zsh.plugin" :
48
+ f , _ := goprompt .ZSHPluginFiles .ReadFile ("plugin/zsh/prompt_asynczle_setup.zsh" )
49
+ content = string (f )
50
+ }
51
+ fmt .Println (content )
40
52
return nil
41
53
}
0 commit comments