mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
feat(debug): provide shell name on debug
This commit is contained in:
parent
ffd961fc6c
commit
9e73b15a3b
|
@ -16,19 +16,25 @@ import (
|
||||||
|
|
||||||
// debugCmd represents the prompt command
|
// debugCmd represents the prompt command
|
||||||
var debugCmd = &cobra.Command{
|
var debugCmd = &cobra.Command{
|
||||||
Use: "debug",
|
Use: "debug [bash|zsh|fish|powershell|pwsh|cmd|nu|tcsh|elvish|xonsh]",
|
||||||
Short: "Print the prompt in debug mode",
|
Short: "Print the prompt in debug mode",
|
||||||
Long: "Print the prompt in debug mode.",
|
Long: "Print the prompt in debug mode.",
|
||||||
Args: cobra.NoArgs,
|
ValidArgs: supportedShells,
|
||||||
Run: func(_ *cobra.Command, _ []string) {
|
Args: NoArgsOrOneValidArg,
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
|
|
||||||
|
if len(args) == 0 {
|
||||||
|
_ = cmd.Help()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
env := &runtime.Terminal{
|
env := &runtime.Terminal{
|
||||||
CmdFlags: &runtime.Flags{
|
CmdFlags: &runtime.Flags{
|
||||||
Config: configFlag,
|
Config: configFlag,
|
||||||
Debug: true,
|
Debug: true,
|
||||||
PWD: pwd,
|
PWD: pwd,
|
||||||
Shell: shellName,
|
Shell: args[0],
|
||||||
Plain: plain,
|
Plain: plain,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,20 @@ var (
|
||||||
printOutput bool
|
printOutput bool
|
||||||
strict bool
|
strict bool
|
||||||
manual bool
|
manual bool
|
||||||
|
debug bool
|
||||||
|
|
||||||
|
supportedShells = []string{
|
||||||
|
"bash",
|
||||||
|
"zsh",
|
||||||
|
"fish",
|
||||||
|
"powershell",
|
||||||
|
"pwsh",
|
||||||
|
"cmd",
|
||||||
|
"nu",
|
||||||
|
"tcsh",
|
||||||
|
"elvish",
|
||||||
|
"xonsh",
|
||||||
|
}
|
||||||
|
|
||||||
initCmd = &cobra.Command{
|
initCmd = &cobra.Command{
|
||||||
Use: "init [bash|zsh|fish|powershell|pwsh|cmd|nu|tcsh|elvish|xonsh]",
|
Use: "init [bash|zsh|fish|powershell|pwsh|cmd|nu|tcsh|elvish|xonsh]",
|
||||||
|
@ -22,19 +36,8 @@ var (
|
||||||
Long: `Initialize your shell and config.
|
Long: `Initialize your shell and config.
|
||||||
|
|
||||||
See the documentation to initialize your shell: https://ohmyposh.dev/docs/installation/prompt.`,
|
See the documentation to initialize your shell: https://ohmyposh.dev/docs/installation/prompt.`,
|
||||||
ValidArgs: []string{
|
ValidArgs: supportedShells,
|
||||||
"bash",
|
Args: NoArgsOrOneValidArg,
|
||||||
"zsh",
|
|
||||||
"fish",
|
|
||||||
"powershell",
|
|
||||||
"pwsh",
|
|
||||||
"cmd",
|
|
||||||
"nu",
|
|
||||||
"tcsh",
|
|
||||||
"elvish",
|
|
||||||
"xonsh",
|
|
||||||
},
|
|
||||||
Args: NoArgsOrOneValidArg,
|
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
_ = cmd.Help()
|
_ = cmd.Help()
|
||||||
|
|
Loading…
Reference in a new issue