mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-25 02:54:03 -08:00
parent
9349de4998
commit
b21c2d2c71
|
@ -40,7 +40,8 @@ Exports the current config to "~/new_config.omp.json" (in JSON format).`,
|
|||
os.Exit(2)
|
||||
}
|
||||
|
||||
cfg := config.Load(configFlag, shell.GENERIC, false)
|
||||
configFile := config.Path(configFlag)
|
||||
cfg := config.Load(configFile, shell.GENERIC, false)
|
||||
|
||||
validateExportFormat := func() {
|
||||
format = strings.ToLower(format)
|
||||
|
|
|
@ -50,10 +50,11 @@ Exports the config to an image file ~/mytheme.png.
|
|||
Exports the config to an image file using customized output options.`,
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(_ *cobra.Command, _ []string) {
|
||||
cfg := config.Load(configFlag, shell.GENERIC, false)
|
||||
configFile := config.Path(configFlag)
|
||||
cfg := config.Load(configFile, shell.GENERIC, false)
|
||||
|
||||
flags := &runtime.Flags{
|
||||
Config: configFlag,
|
||||
Config: configFile,
|
||||
Shell: shell.GENERIC,
|
||||
TerminalWidth: 150,
|
||||
}
|
||||
|
|
|
@ -40,10 +40,11 @@ Migrates the ~/myconfig.omp.json config file to TOML and writes the result to yo
|
|||
A backup of the current config can be found at ~/myconfig.omp.json.bak.`,
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(_ *cobra.Command, _ []string) {
|
||||
cfg := config.Load(configFlag, shell.GENERIC, true)
|
||||
configFile := config.Path(configFlag)
|
||||
cfg := config.Load(configFile, shell.GENERIC, true)
|
||||
|
||||
flags := &runtime.Flags{
|
||||
Config: configFlag,
|
||||
Config: configFile,
|
||||
Migrate: true,
|
||||
}
|
||||
|
||||
|
|
|
@ -35,10 +35,11 @@ Migrates the ~/myconfig.omp.json config file's glyphs and writes the result to y
|
|||
A backup of the current config can be found at ~/myconfig.omp.json.bak.`,
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(_ *cobra.Command, _ []string) {
|
||||
cfg := config.Load(configFlag, shell.GENERIC, false)
|
||||
configFile := config.Path(configFlag)
|
||||
cfg := config.Load(configFile, shell.GENERIC, false)
|
||||
|
||||
flags := &runtime.Flags{
|
||||
Config: configFlag,
|
||||
Config: configFile,
|
||||
}
|
||||
|
||||
env := &runtime.Terminal{}
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/build"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/config"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/log"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/prompt"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/runtime"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/template"
|
||||
|
@ -36,10 +37,14 @@ func createDebugCmd() *cobra.Command {
|
|||
return
|
||||
}
|
||||
|
||||
cfg := config.Load(configFlag, args[0], false)
|
||||
log.Enable()
|
||||
log.Debug("debug mode enabled")
|
||||
|
||||
configFile := config.Path(configFlag)
|
||||
cfg := config.Load(configFile, args[0], false)
|
||||
|
||||
flags := &runtime.Flags{
|
||||
Config: configFlag,
|
||||
Config: configFile,
|
||||
Debug: true,
|
||||
PWD: pwd,
|
||||
Shell: args[0],
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/config"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/log"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/runtime"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/shell"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/template"
|
||||
|
@ -66,15 +67,19 @@ See the documentation to initialize your shell: https://ohmyposh.dev/docs/instal
|
|||
|
||||
func runInit(sh string) {
|
||||
var startTime time.Time
|
||||
|
||||
if debug {
|
||||
startTime = time.Now()
|
||||
log.Enable()
|
||||
log.Debug("debug mode enabled")
|
||||
}
|
||||
|
||||
cfg := config.Load(configFlag, sh, false)
|
||||
configFile := config.Path(configFlag)
|
||||
cfg := config.Load(configFile, sh, false)
|
||||
|
||||
flags := &runtime.Flags{
|
||||
Shell: sh,
|
||||
Config: configFlag,
|
||||
Config: configFile,
|
||||
Strict: strict,
|
||||
Debug: debug,
|
||||
}
|
||||
|
|
|
@ -25,8 +25,6 @@ import (
|
|||
func Load(configFile, sh string, migrate bool) *Config {
|
||||
defer log.Trace(time.Now())
|
||||
|
||||
configFile = Path(configFile)
|
||||
|
||||
cfg := loadConfig(configFile)
|
||||
|
||||
// only migrate automatically when the switch isn't set
|
||||
|
|
|
@ -462,6 +462,7 @@ func (e *Engine) rectifyTerminalWidth(diff int) {
|
|||
// given configuration options, and is ready to print any
|
||||
// of the prompt components.
|
||||
func New(flags *runtime.Flags) *Engine {
|
||||
flags.Config = config.Path(flags.Config)
|
||||
cfg := config.Load(flags.Config, flags.Shell, flags.Migrate)
|
||||
|
||||
env := &runtime.Terminal{}
|
||||
|
|
|
@ -49,11 +49,6 @@ func (term *Terminal) Init(flags *Flags) {
|
|||
term.CmdFlags = &Flags{}
|
||||
}
|
||||
|
||||
if term.CmdFlags.Debug {
|
||||
log.Enable()
|
||||
log.Debug("debug mode enabled")
|
||||
}
|
||||
|
||||
if term.CmdFlags.Plain {
|
||||
log.Plain()
|
||||
log.Debug("plain mode enabled")
|
||||
|
|
Loading…
Reference in a new issue