mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-21 02:55:37 -08:00
feat(path): get parent folder
This commit is contained in:
parent
19a5c65aa1
commit
79e76c8f3f
|
@ -6,6 +6,7 @@ import (
|
|||
"oh-my-posh/properties"
|
||||
"oh-my-posh/regex"
|
||||
"oh-my-posh/template"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
@ -107,6 +108,10 @@ func (pt *Path) Enabled() bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func (pt *Path) Parent() string {
|
||||
return filepath.Dir(pt.pwd)
|
||||
}
|
||||
|
||||
func (pt *Path) formatWindowsDrive(pwd string) string {
|
||||
if pt.env.GOOS() != environment.WindowsPlatform || !strings.HasSuffix(pwd, ":") {
|
||||
return pwd
|
||||
|
|
|
@ -147,6 +147,7 @@ folders at the same level, so if `C:\projectA\dev` and `C:\projectB\dev` exist,
|
|||
### Properties
|
||||
|
||||
- `.Path`: `string` - the current directory (based on the `style` property)
|
||||
- `.Parent`: `string` - the current directory's parent folder
|
||||
- `.Location`: `string` - the current directory (raw value)
|
||||
- `.StackCount`: `int` - the stack count
|
||||
- `.Writable`: `boolean` - is the current directory writable by the user or not
|
||||
|
|
Loading…
Reference in a new issue