mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-31 13:57:26 -08:00
parent
8b93da005e
commit
b9dd5c18a8
|
@ -23,6 +23,7 @@ type Path struct {
|
||||||
StackCount int
|
StackCount int
|
||||||
Location string
|
Location string
|
||||||
Writable bool
|
Writable bool
|
||||||
|
RootDir bool
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -427,6 +428,9 @@ func (pt *Path) replaceMappedLocations() (string, string) {
|
||||||
sort.Sort(sort.Reverse(sort.StringSlice(keys)))
|
sort.Sort(sort.Reverse(sort.StringSlice(keys)))
|
||||||
|
|
||||||
root, relative := pt.parsePath(pt.pwd)
|
root, relative := pt.parsePath(pt.pwd)
|
||||||
|
if len(relative) == 0 {
|
||||||
|
pt.RootDir = true
|
||||||
|
}
|
||||||
rootN := pt.normalize(root)
|
rootN := pt.normalize(root)
|
||||||
relativeN := pt.normalize(relative)
|
relativeN := pt.normalize(relative)
|
||||||
pathSeparator := pt.env.PathSeparator()
|
pathSeparator := pt.env.PathSeparator()
|
||||||
|
|
|
@ -151,9 +151,10 @@ folders at the same level, so if `C:\projectA\dev` and `C:\projectB\dev` exist,
|
||||||
### Properties
|
### Properties
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
| ------------- | --------- | ---------------------------------------------------------------------------- |
|
| ------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `.Path` | `string` | the current directory (based on the `style` property) |
|
| `.Path` | `string` | the current directory (based on the `style` property) |
|
||||||
| `.Parent` | `string` | the current directory's parent folder which ends with a path separator (designed for use with style `folder`, it is empty if `.Path` contains only one single element) |
|
| `.Parent` | `string` | the current directory's parent folder which ends with a path separator (designed for use with style `folder`, it is empty if `.Path` contains only one single element) |
|
||||||
|
| `.RootDir` | `boolean` | true if we're at the root directory (no parent) |
|
||||||
| `.Location` | `string` | the current directory (raw value) |
|
| `.Location` | `string` | the current directory (raw value) |
|
||||||
| `.StackCount` | `int` | the stack count |
|
| `.StackCount` | `int` | the stack count |
|
||||||
| `.Writable` | `boolean` | is the current directory writable by the user or not |
|
| `.Writable` | `boolean` | is the current directory writable by the user or not |
|
||||||
|
|
Loading…
Reference in a new issue