Skip to content

Commit

Permalink
feat: print versin next to smash interactive shell
Browse files Browse the repository at this point in the history
  • Loading branch information
tsukinoko-kun committed Sep 28, 2024
1 parent 5eb8d85 commit 0446cd9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/system/system.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package system

import (
"runtime/debug"
"smash/internal/color"
"strings"
)
Expand Down Expand Up @@ -52,7 +53,11 @@ func fetchInfo(i int) (string, bool) {
case 0:
return color.FgYellow + "OS" + color.Reset + ": " + Name, true
case 1:
return color.FgYellow + "Interactive Shell" + color.Reset + ": smash", true
if info, ok := debug.ReadBuildInfo(); ok {
return color.FgYellow + "Interactive Shell" + color.Reset + ": smash " + info.Main.Version, true
} else {
return color.FgYellow + "Interactive Shell" + color.Reset + ": smash", true
}
case 2:
return color.FgYellow + "Default Shell" + color.Reset + ": " + DefaultShell, true
default:
Expand Down

0 comments on commit 0446cd9

Please sign in to comment.