Skip to content

Commit b332e1d

Browse files
authored
update setup install cmd info (#143)
* update setup install cmd info * update demo * add doc comment
1 parent be63fdd commit b332e1d

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

cmd/setup/setup.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func NewInstallCommand() *cobra.Command {
5555
return fmt.Errorf("failed to write template config: %w", err)
5656
}
5757

58+
ui.PrintSetupInstallCmdInfo(aliasManager.GetRcPath(), config.Get().ConfigDir())
5859
return nil
5960
},
6061
}

docs/demo/pmg-intro.gif

15.1 KB
Loading

docs/demo/pmg-sandbox.gif

10.3 KB
Loading

internal/alias/alias.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func New(config AliasConfig, rcFileManager RcFileManager) *AliasManager {
112112
// Install creates the RC file with aliases and sources it in shell configurations.
113113
func (a *AliasManager) Install() error {
114114
aliases := a.buildAliases()
115-
rcPath, err := a.rcFileManager.Create(aliases)
115+
_, err := a.rcFileManager.Create(aliases)
116116
if err != nil {
117117
return fmt.Errorf("failed to create alias file: %w", err)
118118
}
@@ -122,10 +122,6 @@ func (a *AliasManager) Install() error {
122122
return fmt.Errorf("failed to update shell configs: %w", err)
123123
}
124124

125-
fmt.Printf("%s %s\n", ui.Colors.Green("✓"), "PMG aliases installed successfully")
126-
fmt.Printf(" %s\n", ui.Colors.Dim(fmt.Sprintf("Created: %s", rcPath)))
127-
fmt.Printf(" %s\n", ui.Colors.Dim("Restart your terminal or source your shell to use the new aliases"))
128-
129125
return nil
130126
}
131127

@@ -143,6 +139,11 @@ func (a *AliasManager) Remove() error {
143139
return nil
144140
}
145141

142+
// GetRcPath returns the path to the alias RC file managed by AliasManager.
143+
func (a *AliasManager) GetRcPath() string {
144+
return a.rcFileManager.GetRcPath()
145+
}
146+
146147
// IsInstalled checks if the PMG aliases are sourced in any of the shell config files.
147148
func (a *AliasManager) IsInstalled() (bool, error) {
148149
homeDir, err := os.UserHomeDir()

internal/ui/info.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ func PrintInfoSection(title string, entries map[string]string) {
2323
fmt.Printf("%-25s: %s\n", Colors.Bold(k), entries[k])
2424
}
2525
}
26+
27+
// PrintSetupInstallCmdInfo prints a success message with the alias & config path, and a restart reminder.
28+
func PrintSetupInstallCmdInfo(rcPath, configPath string) {
29+
fmt.Printf("%s %s\n", Colors.Green("✓"), "PMG aliases installed successfully")
30+
fmt.Printf(" %s\n", Colors.Dim(fmt.Sprintf("Installed to: %s", rcPath)))
31+
fmt.Printf(" %s\n", Colors.Dim(fmt.Sprintf("Config at: %s", configPath)))
32+
fmt.Printf(" %s\n", Colors.Dim("Restart your terminal or source your shell to use the new aliases"))
33+
}

0 commit comments

Comments
 (0)