Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed default placeholder will introduce determine error #2

Merged
merged 4 commits into from
Jun 5, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,13 @@ func main() {
pathArgs = []string{"./"}
}

if *replacementFormatPtr != "" {
sequenceNumber = *seqStart
*replacementPtr = ""
*fileOnlyPtr = true
}

// Build pattern from prefix/suffix options
if *trimPrefixPtr != "" {
*matchPatternPtr = "^" + regexp.QuoteMeta(*trimPrefixPtr)
*replacementPtr = ""
*replacementFormatPtr = ""
} else if *trimSuffixPtr != "" {
*matchPatternPtr = regexp.QuoteMeta(*trimSuffixPtr) + "$"
*replacementPtr = ""
*replacementFormatPtr = ""
}

if *matchPatternPtr == "" {
Expand All @@ -131,6 +123,10 @@ func main() {
if *replacementPtr == "{replacement}" && *replacementFormatPtr == "{replacement}" {
log.Fatalln("replacement is required. use -replace 'replacement' or -replace-format 'replacement with format'")
}
if *replacementFormatPtr != "{replacement}" {
sequenceNumber = *seqStart
*fileOnlyPtr = true
}

var matchRegExp = regexp.MustCompile(*matchPatternPtr)
var extRegExp *regexp.Regexp = nil
Expand Down Expand Up @@ -192,11 +188,12 @@ func main() {
sort.Sort(SizeReverseSort{entryQueue})
}
}
}

for index, _ := range entryQueue {
entryOutput <- &(entryQueue[index])
}
for index, _ := range entryQueue {
entryOutput <- &(entryQueue[index])
}

entryOutput <- nil
close(entryOutput)

Expand Down