-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
path.go
749 lines (641 loc) · 19.4 KB
/
path.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
package segments
import (
"fmt"
"sort"
"strings"
"github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/properties"
"github.com/jandedobbeleer/oh-my-posh/src/regex"
"github.com/jandedobbeleer/oh-my-posh/src/shell"
"github.com/jandedobbeleer/oh-my-posh/src/template"
)
type Path struct {
props properties.Properties
env platform.Environment
root string
relative string
pwd string
Path string
StackCount int
Location string
Writable bool
RootDir bool
Folders Folders
}
const (
// FolderSeparatorIcon the path which is split will be separated by this icon
FolderSeparatorIcon properties.Property = "folder_separator_icon"
// FolderSeparatorTemplate the path which is split will be separated by this template
FolderSeparatorTemplate properties.Property = "folder_separator_template"
// HomeIcon indicates the $HOME location
HomeIcon properties.Property = "home_icon"
// FolderIcon identifies one folder
FolderIcon properties.Property = "folder_icon"
// WindowsRegistryIcon indicates the registry location on Windows
WindowsRegistryIcon properties.Property = "windows_registry_icon"
// Agnoster displays a short path with separator icon, this the default style
Agnoster string = "agnoster"
// AgnosterFull displays all the folder names with the folder_separator_icon
AgnosterFull string = "agnoster_full"
// AgnosterShort displays the folder names with one folder_separator_icon, regardless of depth
AgnosterShort string = "agnoster_short"
// Short displays a shorter path
Short string = "short"
// Full displays the full path
Full string = "full"
// FolderType displays the current folder
FolderType string = "folder"
// Mixed like agnoster, but if a folder name is short enough, it is displayed as-is
Mixed string = "mixed"
// Letter like agnoster, but with the first letter of each folder name
Letter string = "letter"
// Unique like agnoster, but with the first unique letters of each folder name
Unique string = "unique"
// AgnosterLeft like agnoster, but keeps the left side of the path
AgnosterLeft string = "agnoster_left"
// Powerlevel tries to mimic the powerlevel10k path,
// used in combination with max_width.
Powerlevel string = "powerlevel"
// MixedThreshold the threshold of the length of the path Mixed will display
MixedThreshold properties.Property = "mixed_threshold"
// MappedLocations allows overriding certain location with an icon
MappedLocations properties.Property = "mapped_locations"
// MappedLocationsEnabled enables overriding certain locations with an icon
MappedLocationsEnabled properties.Property = "mapped_locations_enabled"
// MaxDepth Maximum path depth to display whithout shortening
MaxDepth properties.Property = "max_depth"
// MaxWidth Maximum path width to display for powerlevel style
MaxWidth properties.Property = "max_width"
// Hides the root location if it doesn't fit in max_depth. Used in Agnoster Short
HideRootLocation properties.Property = "hide_root_location"
// A color override cycle
Cycle properties.Property = "cycle"
// Color the path separators within the cycle
CycleFolderSeparator properties.Property = "cycle_folder_separator"
// format to use on the folder names
FolderFormat properties.Property = "folder_format"
// format to use on the first and last folder of the path
EdgeFormat properties.Property = "edge_format"
// format to use on first folder of the path
LeftFormat properties.Property = "left_format"
// format to use on the last folder of the path
RightFormat properties.Property = "right_format"
// GitDirFormat format to use on the git directory
GitDirFormat properties.Property = "gitdir_format"
)
func (pt *Path) Template() string {
return " {{ .Path }} "
}
func (pt *Path) Enabled() bool {
pt.setPaths()
if len(pt.pwd) == 0 {
return false
}
pt.setStyle()
pwd := pt.env.Pwd()
if pt.env.IsWsl() {
pt.Location, _ = pt.env.RunCommand("wslpath", "-m", pwd)
} else {
pt.Location = pwd
}
pt.StackCount = pt.env.StackCount()
pt.Writable = pt.env.DirIsWritable(pwd)
return true
}
func (pt *Path) setPaths() {
defer func() {
pt.Folders = pt.splitPath()
}()
pt.pwd = pt.env.Pwd()
if (pt.env.Shell() == shell.PWSH || pt.env.Shell() == shell.PWSH5) && len(pt.env.Flags().PSWD) != 0 {
pt.pwd = pt.env.Flags().PSWD
}
if len(pt.pwd) == 0 {
return
}
// ensure a clean path
pt.root, pt.relative = pt.replaceMappedLocations()
// this is a full replacement of the parent
if len(pt.root) == 0 {
pt.pwd = pt.relative
return
}
pathSeparator := pt.env.PathSeparator()
if !strings.HasSuffix(pt.root, pathSeparator) && len(pt.relative) > 0 {
pt.pwd = pt.root + pathSeparator + pt.relative
return
}
pt.pwd = pt.root + pt.relative
}
func (pt *Path) Parent() string {
if len(pt.pwd) == 0 {
return ""
}
if len(pt.relative) == 0 {
// a root path has no parent
return ""
}
base := platform.Base(pt.env, pt.pwd)
path := pt.replaceFolderSeparators(pt.pwd[:len(pt.pwd)-len(base)])
return path
}
func (pt *Path) Init(props properties.Properties, env platform.Environment) {
pt.props = props
pt.env = env
}
func (pt *Path) setStyle() {
if len(pt.relative) == 0 {
pt.Path = pt.root
if strings.HasSuffix(pt.Path, ":") {
pt.Path += pt.getFolderSeparator()
}
return
}
switch style := pt.props.GetString(properties.Style, Agnoster); style {
case Agnoster:
pt.Path = pt.getAgnosterPath()
case AgnosterFull:
pt.Path = pt.getAgnosterFullPath()
case AgnosterShort:
pt.Path = pt.getAgnosterShortPath()
case Mixed:
pt.Path = pt.getMixedPath()
case Letter:
pt.Path = pt.getLetterPath()
case Unique:
pt.Path = pt.getUniqueLettersPath(0)
case AgnosterLeft:
pt.Path = pt.getAgnosterLeftPath()
case Short:
// "short" is a duplicate of "full", just here for backwards compatibility
fallthrough
case Full:
pt.Path = pt.getFullPath()
case FolderType:
pt.Path = pt.getFolderPath()
case Powerlevel:
maxWidth := int(pt.props.GetFloat64(MaxWidth, 0))
pt.Path = pt.getUniqueLettersPath(maxWidth)
default:
pt.Path = fmt.Sprintf("Path style: %s is not available", style)
}
}
func (pt *Path) getFolderSeparator() string {
separatorTemplate := pt.props.GetString(FolderSeparatorTemplate, "")
if len(separatorTemplate) == 0 {
separator := pt.props.GetString(FolderSeparatorIcon, pt.env.PathSeparator())
// if empty, use the default separator
if len(separator) == 0 {
return pt.env.PathSeparator()
}
return separator
}
tmpl := &template.Text{
Template: separatorTemplate,
Context: pt,
Env: pt.env,
}
text, err := tmpl.Render()
if err != nil {
pt.env.Error(err)
}
if len(text) == 0 {
return pt.env.PathSeparator()
}
return text
}
func (pt *Path) getMixedPath() string {
var buffer strings.Builder
threshold := int(pt.props.GetFloat64(MixedThreshold, 4))
folderIcon := pt.props.GetString(FolderIcon, "..")
separator := pt.getFolderSeparator()
if pt.root != pt.env.PathSeparator() {
pt.Folders = append(Folders{{Name: pt.root}}, pt.Folders...)
}
n := len(pt.Folders)
buffer.WriteString(pt.Folders[0].Name)
for i := 1; i < n; i++ {
folder := pt.Folders[i].Name
if len(folder) > threshold && i != n-1 && !pt.Folders[i].Display {
folder = folderIcon
}
buffer.WriteString(fmt.Sprintf("%s%s", separator, folder))
}
return buffer.String()
}
func (pt *Path) getAgnosterPath() string {
folderIcon := pt.props.GetString(FolderIcon, "..")
if pt.root == pt.env.PathSeparator() {
pt.root = pt.Folders[0].Name
pt.Folders = pt.Folders[1:]
}
var elements []string
n := len(pt.Folders)
for i := 1; i < n; i++ {
if pt.Folders[i].Display {
elements = append(elements, pt.Folders[i].Name)
continue
}
elements = append(elements, folderIcon)
}
if len(pt.Folders) > 0 {
elements = append(elements, pt.Folders[n-1].Name)
}
return pt.colorizePath(pt.root, elements)
}
func (pt *Path) getAgnosterLeftPath() string {
folderIcon := pt.props.GetString(FolderIcon, "..")
if pt.root == pt.env.PathSeparator() {
pt.root = pt.Folders[0].Name
pt.Folders = pt.Folders[1:]
}
var elements []string
n := len(pt.Folders)
elements = append(elements, pt.Folders[0].Name)
for i := 1; i < n; i++ {
if pt.Folders[i].Display {
elements = append(elements, pt.Folders[i].Name)
continue
}
elements = append(elements, folderIcon)
}
return pt.colorizePath(pt.root, elements)
}
func (pt *Path) getRelevantLetter(folder *Folder) string {
if folder.Display {
return folder.Name
}
// check if there is at least a letter we can use
matches := regex.FindNamedRegexMatch(`(?P<letter>[\p{L}0-9]).*`, folder.Name)
if matches == nil || len(matches["letter"]) == 0 {
// no letter found, keep the folder unchanged
return folder.Name
}
letter := matches["letter"]
// handle non-letter characters before the first found letter
letter = folder.Name[0:strings.Index(folder.Name, letter)] + letter
return letter
}
func (pt *Path) getLetterPath() string {
if pt.root == pt.env.PathSeparator() {
pt.root = pt.Folders[0].Name
pt.Folders = pt.Folders[1:]
}
pt.root = pt.getRelevantLetter(&Folder{Name: pt.root})
var elements []string
n := len(pt.Folders)
for i := 0; i < n-1; i++ {
if pt.Folders[i].Display {
elements = append(elements, pt.Folders[i].Name)
continue
}
letter := pt.getRelevantLetter(pt.Folders[i])
elements = append(elements, letter)
}
if len(pt.Folders) > 0 {
elements = append(elements, pt.Folders[n-1].Name)
}
return pt.colorizePath(pt.root, elements)
}
func (pt *Path) getUniqueLettersPath(maxWidth int) string {
separator := pt.getFolderSeparator()
if pt.root == pt.env.PathSeparator() {
pt.root = pt.Folders[0].Name
pt.Folders = pt.Folders[1:]
}
if maxWidth > 0 {
path := strings.Join(pt.Folders.List(), separator)
if len(path) <= maxWidth {
return pt.colorizePath(pt.root, pt.Folders.List())
}
}
pt.root = pt.getRelevantLetter(&Folder{Name: pt.root})
var elements []string
n := len(pt.Folders)
letters := make(map[string]bool)
letters[pt.root] = true
for i := 0; i < n-1; i++ {
folder := pt.Folders[i].Name
letter := pt.getRelevantLetter(pt.Folders[i])
for letters[letter] {
if letter == folder {
break
}
letter += folder[len(letter) : len(letter)+1]
}
letters[letter] = true
elements = append(elements, letter)
// only return early on maxWidth > 0
// this enables the powerlevel10k behavior
if maxWidth > 0 {
list := pt.Folders[i+1:].List()
list = append(list, elements...)
current := strings.Join(list, separator)
leftover := maxWidth - len(current) - len(pt.root) - len(separator)
if leftover >= 0 {
elements = append(elements, strings.Join(pt.Folders[i+1:].List(), separator))
return pt.colorizePath(pt.root, elements)
}
}
}
if len(pt.Folders) > 0 {
elements = append(elements, pt.Folders[n-1].Name)
}
return pt.colorizePath(pt.root, elements)
}
func (pt *Path) getAgnosterFullPath() string {
if pt.root == pt.env.PathSeparator() {
pt.root = pt.Folders[0].Name
pt.Folders = pt.Folders[1:]
}
return pt.colorizePath(pt.root, pt.Folders.List())
}
func (pt *Path) getAgnosterShortPath() string {
pathDepth := len(pt.Folders)
maxDepth := pt.props.GetInt(MaxDepth, 1)
if maxDepth < 1 {
maxDepth = 1
}
folderIcon := pt.props.GetString(FolderIcon, "..")
hideRootLocation := pt.props.GetBool(HideRootLocation, false)
if pathDepth <= maxDepth {
if hideRootLocation {
pt.root = folderIcon
}
return pt.getAgnosterFullPath()
}
pathSeparator := pt.env.PathSeparator()
splitPos := pathDepth - maxDepth
var folders []string
// unix root, needs to be replaced with the folder we're in at root level
root := pt.root
room := pathDepth - maxDepth
if root == pathSeparator {
root = pt.Folders[0].Name
room--
}
if hideRootLocation || room > 0 {
folders = append(folders, folderIcon)
}
if hideRootLocation {
root = ""
}
for i := splitPos; i < pathDepth; i++ {
folders = append(folders, pt.Folders[i].Name)
}
return pt.colorizePath(root, folders)
}
func (pt *Path) getFullPath() string {
return pt.colorizePath(pt.root, pt.Folders.List())
}
func (pt *Path) getFolderPath() string {
pwd := platform.Base(pt.env, pt.pwd)
return pt.replaceFolderSeparators(pwd)
}
func (pt *Path) replaceMappedLocations() (string, string) {
mappedLocations := map[string]string{}
// predefined mapped locations, can be disabled
if pt.props.GetBool(MappedLocationsEnabled, true) {
mappedLocations["hkcu:"] = pt.props.GetString(WindowsRegistryIcon, "\uF013")
mappedLocations["hklm:"] = pt.props.GetString(WindowsRegistryIcon, "\uF013")
mappedLocations[pt.normalize(pt.env.Home())] = pt.props.GetString(HomeIcon, "~")
}
// merge custom locations with mapped locations
// mapped locations can override predefined locations
keyValues := pt.props.GetKeyValueMap(MappedLocations, make(map[string]string))
for key, val := range keyValues {
if len(key) == 0 {
continue
}
tmpl := &template.Text{
Template: key,
Context: pt,
Env: pt.env,
}
path, err := tmpl.Render()
if err != nil {
pt.env.Error(err)
}
if len(path) == 0 {
continue
}
mappedLocations[pt.normalize(path)] = val
}
// sort map keys in reverse order
// fixes case when a subfoder and its parent are mapped
// ex /users/test and /users/test/dev
keys := make([]string, 0, len(mappedLocations))
for k := range mappedLocations {
keys = append(keys, k)
}
sort.Sort(sort.Reverse(sort.StringSlice(keys)))
root, relative := pt.parsePath(pt.pwd)
if len(relative) == 0 {
pt.RootDir = true
}
rootN := pt.normalize(root)
relativeN := pt.normalize(relative)
pathSeparator := pt.env.PathSeparator()
for _, key := range keys {
keyRoot, keyRelative := pt.parsePath(key)
matchSubFolders := strings.HasSuffix(keyRelative, "*")
if matchSubFolders && len(keyRelative) > 1 {
keyRelative = keyRelative[0 : len(keyRelative)-1] // remove trailing /* or \*
}
if keyRoot != rootN || !strings.HasPrefix(relativeN, keyRelative) {
continue
}
value := mappedLocations[key]
overflow := relative[len(keyRelative):]
if len(overflow) == 0 {
// exactly match the full path
return value, ""
}
if len(keyRelative) == 0 {
// only match the root
return value, strings.Trim(relative, pathSeparator)
}
// match several prefix elements
if matchSubFolders || overflow[0:1] == pt.env.PathSeparator() {
return value, strings.Trim(overflow, pathSeparator)
}
}
return root, strings.Trim(relative, pathSeparator)
}
func (pt *Path) normalizePath(path string) string {
if pt.env.GOOS() != platform.WINDOWS {
return path
}
var clean []rune
for _, char := range path {
var lastChar rune
if len(clean) > 0 {
lastChar = clean[len(clean)-1:][0]
}
if char == '/' && lastChar != 60 { // 60 == <, this is done to ovoid replacing color codes
clean = append(clean, 92) // 92 == \
continue
}
clean = append(clean, char)
}
return string(clean)
}
// ParsePath parses an input path and returns a clean root and a clean path.
func (pt *Path) parsePath(inputPath string) (string, string) {
var root, path string
if len(inputPath) == 0 {
return root, path
}
separator := pt.env.PathSeparator()
clean := func(path string) string {
matches := regex.FindAllNamedRegexMatch(fmt.Sprintf(`(?P<element>[^\%s]+)`, separator), path)
n := len(matches) - 1
s := new(strings.Builder)
for i, m := range matches {
s.WriteString(m["element"])
if i != n {
s.WriteString(separator)
}
}
return s.String()
}
if pt.env.GOOS() == platform.WINDOWS {
inputPath = pt.normalizePath(inputPath)
// for a UNC path, extract \\hostname\sharename as the root
matches := regex.FindNamedRegexMatch(`^\\\\(?P<hostname>[^\\]+)\\+(?P<sharename>[^\\]+)\\*(?P<path>[\s\S]*)$`, inputPath)
if len(matches) > 0 {
root = `\\` + matches["hostname"] + `\` + matches["sharename"]
path = clean(matches["path"])
return root, path
}
}
s := strings.SplitAfterN(inputPath, separator, 2)
root = s[0]
if pt.env.GOOS() == platform.WINDOWS {
root = strings.TrimSuffix(root, separator)
}
if len(s) == 2 {
path = clean(s[1])
}
return root, path
}
func (pt *Path) normalize(inputPath string) string {
normalized := inputPath
if strings.HasPrefix(normalized, "~") && (len(normalized) == 1 || platform.IsPathSeparator(pt.env, normalized[1])) {
normalized = pt.env.Home() + normalized[1:]
}
switch pt.env.GOOS() {
case platform.WINDOWS:
normalized = pt.normalizePath(normalized)
fallthrough
case platform.DARWIN:
normalized = strings.ToLower(normalized)
}
return normalized
}
func (pt *Path) replaceFolderSeparators(pwd string) string {
defaultSeparator := pt.env.PathSeparator()
folderSeparator := pt.getFolderSeparator()
if folderSeparator == defaultSeparator {
return pwd
}
pwd = strings.ReplaceAll(pwd, defaultSeparator, folderSeparator)
return pwd
}
func (pt *Path) colorizePath(root string, elements []string) string {
cycle := pt.props.GetStringArray(Cycle, []string{})
skipColorize := len(cycle) == 0
folderSeparator := pt.getFolderSeparator()
colorSeparator := pt.props.GetBool(CycleFolderSeparator, false)
folderFormat := pt.props.GetString(FolderFormat, "%s")
edgeFormat := pt.props.GetString(EdgeFormat, folderFormat)
leftFormat := pt.props.GetString(LeftFormat, edgeFormat)
rightFormat := pt.props.GetString(RightFormat, edgeFormat)
colorizeElement := func(element string) string {
if skipColorize || len(element) == 0 {
return element
}
defer func() {
cycle = append(cycle[1:], cycle[0])
}()
return fmt.Sprintf("<%s>%s</>", cycle[0], element)
}
if len(elements) == 0 {
root := fmt.Sprintf(leftFormat, root)
return colorizeElement(root)
}
colorizeSeparator := func() string {
if skipColorize || !colorSeparator {
return folderSeparator
}
return fmt.Sprintf("<%s>%s</>", cycle[0], folderSeparator)
}
var builder strings.Builder
root = fmt.Sprintf(leftFormat, root)
builder.WriteString(colorizeElement(root))
if root != pt.env.PathSeparator() && len(root) != 0 {
builder.WriteString(colorizeSeparator())
}
for i, element := range elements {
if len(element) == 0 {
continue
}
format := folderFormat
if i == len(elements)-1 {
format = rightFormat
}
element = fmt.Sprintf(format, element)
builder.WriteString(colorizeElement(element))
if i != len(elements)-1 {
builder.WriteString(colorizeSeparator())
}
}
return builder.String()
}
type Folder struct {
Name string
Display bool
Path string
}
type Folders []*Folder
func (f Folders) List() []string {
var list []string
for _, folder := range f {
list = append(list, folder.Name)
}
return list
}
func (pt *Path) splitPath() Folders {
result := Folders{}
folders := []string{}
if len(pt.relative) != 0 {
folders = strings.Split(pt.relative, pt.env.PathSeparator())
}
folderFormatMap := pt.makeFolderFormatMap()
currentPath := pt.root
if currentPath == "~" {
currentPath = pt.env.Home() + pt.env.PathSeparator()
}
var display bool
for _, folder := range folders {
currentPath += folder
if format := folderFormatMap[currentPath]; len(format) != 0 {
folder = fmt.Sprintf(format, folder)
display = true
}
result = append(result, &Folder{Name: folder, Path: currentPath, Display: display})
currentPath += pt.env.PathSeparator()
display = false
}
return result
}
func (pt *Path) makeFolderFormatMap() map[string]string {
folderFormatMap := make(map[string]string)
if gitDirFormat := pt.props.GetString(GitDirFormat, ""); len(gitDirFormat) != 0 {
dir, err := pt.env.HasParentFilePath(".git")
if err == nil && dir.IsDir {
folderFormatMap[dir.ParentFolder] = gitDirFormat
}
}
return folderFormatMap
}