fix rename: handle 2-1 chord with spaces in paths
- Check for rename command BEFORE splitting args on whitespace - Preserves spaces in file paths when using acme 2-1 chord - Handles both 'rename /path' and 'rename /path Title tags' formats
This commit is contained in:
parent
8e02306682
commit
ce046de0b3
|
|
@ -279,7 +279,28 @@ func main() {
|
|||
dir := flag.String("dir", denote.DefaultDir(), "denote directory")
|
||||
flag.Parse()
|
||||
|
||||
// Split args on whitespace to handle acme mouse chording
|
||||
// Check for rename command BEFORE splitting args (to preserve spaces in paths)
|
||||
if len(flag.Args()) > 0 {
|
||||
firstArg := flag.Args()[0]
|
||||
// Check if first arg starts with "rename " or is exactly "rename"
|
||||
if strings.HasPrefix(firstArg, "rename ") {
|
||||
// "rename /path/to/file ..." - extract everything after "rename "
|
||||
rest := strings.TrimPrefix(firstArg, "rename ")
|
||||
var renameArgs []string
|
||||
if rest != "" {
|
||||
renameArgs = append(renameArgs, rest)
|
||||
}
|
||||
renameArgs = append(renameArgs, flag.Args()[1:]...)
|
||||
handleRename(renameArgs)
|
||||
return
|
||||
} else if firstArg == "rename" {
|
||||
// "rename" as separate arg
|
||||
handleRename(flag.Args()[1:])
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Split args on whitespace to handle acme mouse chording (for filters/search)
|
||||
var filterArgs []string
|
||||
for _, arg := range flag.Args() {
|
||||
filterArgs = append(filterArgs, strings.Fields(arg)...)
|
||||
|
|
@ -329,12 +350,6 @@ For 'rename' command help: Denote rename
|
|||
return
|
||||
}
|
||||
|
||||
// Check if this is a "rename" command
|
||||
if len(filterArgs) > 0 && filterArgs[0] == "rename" {
|
||||
handleRename(filterArgs[1:])
|
||||
return
|
||||
}
|
||||
|
||||
var filters []*denote.Filter
|
||||
sortType := denote.SortByID // Default sort
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue