oh-my-fish / plugin-bak

Helps you instantly backup and restore files
MIT License
5 stars 3 forks source link

Can't mvbak on a file with an empty space #7

Open BarbzYHOOL opened 5 years ago

BarbzYHOOL commented 5 years ago
mvbak "my test file"
mv: target ‘file.20190225_155546.bak’ is not a directory

I also get other errors:

mvbak eee\ \(autre\ copie\)
autre: command not found
- (line 1): 
autre copie
^
in command substitution
    called on line -1 of file -

from sourcing file -
    called on line 60 of file /usr/share/fish/functions/eval.fish

in function 'eval'
    called on line 6 of file ~/.config/fish/fundle/BarbzYHOOL/plugin-bak/functions/__bak.fish

in function '__bak'
    called on line 5 of file ~/.config/fish/fundle/BarbzYHOOL/plugin-bak/functions/mvbak.fish
    with parameter list 'mvbak mv eee (autre copie)'

in function 'mvbak'
    called on standard input
    with parameter list 'eee (autre copie)'

autre: command not found
- (line 1): 
autre copie
^
in command substitution
    called on line -1 of file -

from sourcing file -
    called on line 60 of file /usr/share/fish/functions/eval.fish

in function 'eval'
    called on line 6 of file ~/.config/fish/fundle/BarbzYHOOL/plugin-bak/functions/__bak.fish

in function '__bak'
    called on line 5 of file ~/.config/fish/fundle/BarbzYHOOL/plugin-bak/functions/mvbak.fish
    with parameter list 'mvbak mv eee (autre copie)'

in function 'mvbak'
    called on standard input
    with parameter list 'eee (autre copie)'

mv: cannot stat ‘eee’: No such file or directory

I tried to fix it by adding quotes to some variables, but it still doesn't work

Usage:
  mvbak SOURCE...

Need some guidance here :'( @bobthecow

BarbzYHOOL commented 5 years ago

Ok I found the solution, but which one is better?

function mvbak --description 'Rename files to make a backup copies'
  __bak mvbak mv '$argv'
end
function mvbak --description 'Rename files to make a backup copies'
  __bak mvbak mv \"$argv\"
end

The second one looks better to me (cause it's clear)

BarbzYHOOL commented 5 years ago

Also if you have a dir called "foo bar/" it will fail to remove the "/"

__mv_bak_name works fine but the overall program does not:

mvbak pa\ pa\ pa/                                                            
mv: cannot move ‘pa pa pa/’ to a subdirectory of itself, ‘pa pa pa/.20190225_162111.bak’
BarbzYHOOL commented 1 year ago

@bobthecow @scorphus

BarbzYHOOL commented 10 months ago

@bobthecow I fixed it on my repo https://github.com/BarbzYHOOL/plugin-bak/tree/master

scorphus commented 10 months ago

Would you kindly open a PR?

Thank you!

BarbzYHOOL commented 10 months ago

i tried to do it https://github.com/oh-my-fish/plugin-bak/pull/9