Skip to content

Commit a17a74b

Browse files
authored
Merge pull request #2 from Kipari/master
Fix compatibility with newer versions of ranger and fix accidental overwrite of standard commands
2 parents 82dce96 + 81e055f commit a17a74b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

annex.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,30 @@ def reload_dir():
4949

5050

5151
def fnames(fm):
52-
return (str(fname) for fname in fm.env.get_selection())
52+
return (str(fname) for fname in fm.thistab.get_selection())
5353

5454

55-
class add(Command):
55+
class annex_add(Command):
5656
def execute(self):
5757
self.fm.loader.add(CommandLoader(['git', 'annex', 'add'], 'annex:add'))
5858
self.fm.loader.add(CommandLoader(['git', 'commit', '-m', '"add files"'], 'git:commit'))
5959

6060

61-
class get(Command):
61+
class annex_get(Command):
6262
def execute(self):
6363
for fname in fnames(self.fm):
6464
if not os.path.exists(fname):
6565
annex_call(self.fm, ['get'], fname)
6666

6767

68-
class drop(Command):
68+
class annex_drop(Command):
6969
def execute(self):
7070
for fname in fnames(self.fm):
7171
if os.path.exists(fname):
7272
annex_call(self.fm, ['drop'], fname)
7373

7474

75-
class copy(Command):
75+
class annex_copy(Command):
7676
def tab(self):
7777
return ('annex_copy {}'.format(r) for r in remotes())
7878

@@ -88,19 +88,19 @@ def execute(self):
8888
annex_call(self.fm, ['copy', '-t', remote], fname)
8989

9090

91-
class sync(Command):
91+
class annex_sync(Command):
9292
def execute(self):
9393
cmd = 'git annex sync --fast --quiet'.split()
9494
self.fm.loader.add(CommandLoader(cmd, 'annex:sync'))
9595

9696

9797
def hook_init(fm):
9898
if annex_exists():
99-
fm.commands.commands['annex_add'] = add
100-
fm.commands.commands['annex_copy'] = copy
101-
fm.commands.commands['annex_drop'] = drop
102-
fm.commands.commands['annex_get'] = get
103-
fm.commands.commands['annex_sync'] = sync
99+
fm.commands.commands['annex_add'] = annex_add
100+
fm.commands.commands['annex_copy'] = annex_copy
101+
fm.commands.commands['annex_drop'] = annex_drop
102+
fm.commands.commands['annex_get'] = annex_get
103+
fm.commands.commands['annex_sync'] = annex_sync
104104
else:
105105
fm.notify('Could not find git-annex', bad=True)
106106

0 commit comments

Comments
 (0)