mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-13 04:07:25 -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)
|
os.Exit(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := config.Load(configFlag, shell.GENERIC, false)
|
configFile := config.Path(configFlag)
|
||||||
|
cfg := config.Load(configFile, shell.GENERIC, false)
|
||||||
|
|
||||||
validateExportFormat := func() {
|
validateExportFormat := func() {
|
||||||
format = strings.ToLower(format)
|
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.`,
|
Exports the config to an image file using customized output options.`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
Run: func(_ *cobra.Command, _ []string) {
|
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{
|
flags := &runtime.Flags{
|
||||||
Config: configFlag,
|
Config: configFile,
|
||||||
Shell: shell.GENERIC,
|
Shell: shell.GENERIC,
|
||||||
TerminalWidth: 150,
|
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.`,
|
A backup of the current config can be found at ~/myconfig.omp.json.bak.`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
Run: func(_ *cobra.Command, _ []string) {
|
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{
|
flags := &runtime.Flags{
|
||||||
Config: configFlag,
|
Config: configFile,
|
||||||
Migrate: true,
|
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.`,
|
A backup of the current config can be found at ~/myconfig.omp.json.bak.`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
Run: func(_ *cobra.Command, _ []string) {
|
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{
|
flags := &runtime.Flags{
|
||||||
Config: configFlag,
|
Config: configFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
env := &runtime.Terminal{}
|
env := &runtime.Terminal{}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/jandedobbeleer/oh-my-posh/src/build"
|
"github.com/jandedobbeleer/oh-my-posh/src/build"
|
||||||
"github.com/jandedobbeleer/oh-my-posh/src/config"
|
"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/prompt"
|
||||||
"github.com/jandedobbeleer/oh-my-posh/src/runtime"
|
"github.com/jandedobbeleer/oh-my-posh/src/runtime"
|
||||||
"github.com/jandedobbeleer/oh-my-posh/src/template"
|
"github.com/jandedobbeleer/oh-my-posh/src/template"
|
||||||
|
@ -36,10 +37,14 @@ func createDebugCmd() *cobra.Command {
|
||||||
return
|
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{
|
flags := &runtime.Flags{
|
||||||
Config: configFlag,
|
Config: configFile,
|
||||||
Debug: true,
|
Debug: true,
|
||||||
PWD: pwd,
|
PWD: pwd,
|
||||||
Shell: args[0],
|
Shell: args[0],
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/jandedobbeleer/oh-my-posh/src/config"
|
"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/runtime"
|
||||||
"github.com/jandedobbeleer/oh-my-posh/src/shell"
|
"github.com/jandedobbeleer/oh-my-posh/src/shell"
|
||||||
"github.com/jandedobbeleer/oh-my-posh/src/template"
|
"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) {
|
func runInit(sh string) {
|
||||||
var startTime time.Time
|
var startTime time.Time
|
||||||
|
|
||||||
if debug {
|
if debug {
|
||||||
startTime = time.Now()
|
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{
|
flags := &runtime.Flags{
|
||||||
Shell: sh,
|
Shell: sh,
|
||||||
Config: configFlag,
|
Config: configFile,
|
||||||
Strict: strict,
|
Strict: strict,
|
||||||
Debug: debug,
|
Debug: debug,
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,6 @@ import (
|
||||||
func Load(configFile, sh string, migrate bool) *Config {
|
func Load(configFile, sh string, migrate bool) *Config {
|
||||||
defer log.Trace(time.Now())
|
defer log.Trace(time.Now())
|
||||||
|
|
||||||
configFile = Path(configFile)
|
|
||||||
|
|
||||||
cfg := loadConfig(configFile)
|
cfg := loadConfig(configFile)
|
||||||
|
|
||||||
// only migrate automatically when the switch isn't set
|
// 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
|
// given configuration options, and is ready to print any
|
||||||
// of the prompt components.
|
// of the prompt components.
|
||||||
func New(flags *runtime.Flags) *Engine {
|
func New(flags *runtime.Flags) *Engine {
|
||||||
|
flags.Config = config.Path(flags.Config)
|
||||||
cfg := config.Load(flags.Config, flags.Shell, flags.Migrate)
|
cfg := config.Load(flags.Config, flags.Shell, flags.Migrate)
|
||||||
|
|
||||||
env := &runtime.Terminal{}
|
env := &runtime.Terminal{}
|
||||||
|
|
|
@ -49,11 +49,6 @@ func (term *Terminal) Init(flags *Flags) {
|
||||||
term.CmdFlags = &Flags{}
|
term.CmdFlags = &Flags{}
|
||||||
}
|
}
|
||||||
|
|
||||||
if term.CmdFlags.Debug {
|
|
||||||
log.Enable()
|
|
||||||
log.Debug("debug mode enabled")
|
|
||||||
}
|
|
||||||
|
|
||||||
if term.CmdFlags.Plain {
|
if term.CmdFlags.Plain {
|
||||||
log.Plain()
|
log.Plain()
|
||||||
log.Debug("plain mode enabled")
|
log.Debug("plain mode enabled")
|
||||||
|
|
Loading…
Reference in a new issue