mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-09-03 23:57:23 -04:00
More correctly use build constraints in entryList.go
This commit is contained in:
+2
-10
@@ -161,11 +161,7 @@ func EntryListGen() {
|
|||||||
containsFiles = true
|
containsFiles = true
|
||||||
skippedDirList[i] = false // the directory header is being printed, indicate that it is not being skipped
|
skippedDirList[i] = false // the directory header is being printed, indicate that it is not being skipped
|
||||||
indent, vanityDirectory = indentSubtractor(skippedDirList, dirList, i, indent) // calculate the final indentation multiplier
|
indent, vanityDirectory = indentSubtractor(skippedDirList, dirList, i, indent) // calculate the final indentation multiplier
|
||||||
if !offline.Windows { // for consistency, format directories with UNIX-style path separators on all platforms
|
printDirectoryHeader(vanityDirectory, indent)
|
||||||
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+offline.AnsiReset+"\n", vanityDirectory)
|
|
||||||
} else {
|
|
||||||
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+offline.AnsiReset+"\n", strings.ReplaceAll(vanityDirectory, offline.PathSeparator, "/"))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
charCounter, colorAlternator = printFileEntry(file, lastSlash, charCounter, colorAlternator, indent)
|
charCounter, colorAlternator = printFileEntry(file, lastSlash, charCounter, colorAlternator, indent)
|
||||||
@@ -177,11 +173,7 @@ func EntryListGen() {
|
|||||||
if dirListLength > 1 { // and directories besides the root-level exist... display directory header and empty directory warning
|
if dirListLength > 1 { // and directories besides the root-level exist... display directory header and empty directory warning
|
||||||
skippedDirList[i] = false // the directory header is being printed, indicate that it is not being skipped
|
skippedDirList[i] = false // the directory header is being printed, indicate that it is not being skipped
|
||||||
indent, vanityDirectory = indentSubtractor(skippedDirList, dirList, i, indent) // calculate the final indentation multiplier
|
indent, vanityDirectory = indentSubtractor(skippedDirList, dirList, i, indent) // calculate the final indentation multiplier
|
||||||
if !offline.Windows { // for consistency, format directories with UNIX-style path separators on all platforms
|
printDirectoryHeader(vanityDirectory, indent)
|
||||||
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+offline.AnsiReset+"\n", vanityDirectory)
|
|
||||||
} else {
|
|
||||||
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+offline.AnsiReset+"\n", strings.ReplaceAll(vanityDirectory, offline.PathSeparator, "/"))
|
|
||||||
}
|
|
||||||
fmt.Print(strings.Repeat(" ", indent*2) + ansiEmptyDirectoryWarning + "-empty directory-" + offline.AnsiReset)
|
fmt.Print(strings.Repeat(" ", indent*2) + ansiEmptyDirectoryWarning + "-empty directory-" + offline.AnsiReset)
|
||||||
} else { // warn if the only thing that exists is the root-level directory
|
} else { // warn if the only thing that exists is the root-level directory
|
||||||
fmt.Print("\n\nNothing's here! For help creating your first entry, run \"mutn help\".")
|
fmt.Print("\n\nNothing's here! For help creating your first entry, run \"mutn help\".")
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package cli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/rwinkhart/MUTN/src/offline"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func printDirectoryHeader(vanityDirectory string, indent int) {
|
||||||
|
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+offline.AnsiReset+"\n", vanityDirectory)
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package cli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/rwinkhart/MUTN/src/offline"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func printDirectoryHeader(vanityDirectory string, indent int) {
|
||||||
|
fmt.Printf("\n\n"+strings.Repeat(" ", indent*2)+ansiDirectoryHeader+"%s/"+offline.AnsiReset+"\n", strings.ReplaceAll(vanityDirectory, offline.PathSeparator, "/"))
|
||||||
|
}
|
||||||
@@ -5,8 +5,5 @@ package offline
|
|||||||
// EntryRoot path to libmutton entry directory
|
// EntryRoot path to libmutton entry directory
|
||||||
var EntryRoot = home + "/.local/share/libmutton"
|
var EntryRoot = home + "/.local/share/libmutton"
|
||||||
|
|
||||||
// exported constants
|
// PathSeparator defines the character used to separate directories in a path (platform-specific)
|
||||||
const (
|
const PathSeparator = "/"
|
||||||
PathSeparator = "/"
|
|
||||||
Windows = false
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -5,8 +5,5 @@ package offline
|
|||||||
// EntryRoot path to libmutton entry directory
|
// EntryRoot path to libmutton entry directory
|
||||||
var EntryRoot = home + "\\AppData\\Local\\libmutton\\entries"
|
var EntryRoot = home + "\\AppData\\Local\\libmutton\\entries"
|
||||||
|
|
||||||
// exported constants
|
// PathSeparator defines the character used to separate directories in a path (platform-specific)
|
||||||
const (
|
const PathSeparator = "\\"
|
||||||
PathSeparator = "\\"
|
|
||||||
Windows = true
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user