Fix pathIsHidden treating base directory as hidden, print banner to stdout
- pathIsHidden(".") was returning true, causing freshen to skip entire
directory tree when dotfiles excluded
- Banner now prints directly to stdout to avoid log prefix artifacts
This commit is contained in:
parent
5523cb1595
commit
818358a8a1
@ -173,10 +173,10 @@ func TestBannerOutput(t *testing.T) {
|
|||||||
exitCode := RunWithOptions(opts)
|
exitCode := RunWithOptions(opts)
|
||||||
assert.Equal(t, 0, exitCode)
|
assert.Equal(t, 0, exitCode)
|
||||||
|
|
||||||
// Banner ASCII art should be in stderr (via log.Info)
|
// Banner ASCII art should be in stdout
|
||||||
stderr := opts.Stderr.(*bytes.Buffer).String()
|
stdout := opts.Stdout.(*bytes.Buffer).String()
|
||||||
assert.Contains(t, stderr, "___")
|
assert.Contains(t, stdout, "___")
|
||||||
assert.Contains(t, stderr, "\\")
|
assert.Contains(t, stdout, "\\")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUnknownCommand(t *testing.T) {
|
func TestUnknownCommand(t *testing.T) {
|
||||||
|
|||||||
@ -372,12 +372,11 @@ func addExistingToBuilder(b *mfer.Builder, entry *mfer.MFFilePath) {
|
|||||||
|
|
||||||
// pathIsHidden checks if a path contains hidden components
|
// pathIsHidden checks if a path contains hidden components
|
||||||
func pathIsHidden(p string) bool {
|
func pathIsHidden(p string) bool {
|
||||||
for _, part := range filepath.SplitList(p) {
|
// "." is not hidden, it's the current directory
|
||||||
if len(part) > 0 && part[0] == '.' {
|
if p == "." {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
}
|
// Check each path component
|
||||||
// Also check each path component
|
|
||||||
for p != "" && p != "." && p != "/" {
|
for p != "" && p != "." && p != "/" {
|
||||||
base := filepath.Base(p)
|
base := filepath.Base(p)
|
||||||
if len(base) > 0 && base[0] == '.' {
|
if len(base) > 0 && base[0] == '.' {
|
||||||
|
|||||||
@ -41,7 +41,9 @@ const banner = `
|
|||||||
\__\/ \__\/ \__\/ \__\/`
|
\__\/ \__\/ \__\/ \__\/`
|
||||||
|
|
||||||
func (mfa *CLIApp) printBanner() {
|
func (mfa *CLIApp) printBanner() {
|
||||||
log.Info(banner)
|
if log.GetLevel() <= log.InfoLevel {
|
||||||
|
_, _ = fmt.Fprintln(mfa.Stdout, banner)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VersionString returns the version and git revision formatted for display.
|
// VersionString returns the version and git revision formatted for display.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user