secret
Created

mkseldir

  • Download Gist
commands.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
from ranger.api.commands import *
class mkseldir(Command):
"""
:mkseldir <dirname>
 
Creates a directory with the name <dirname>, and select it.
"""
 
def execute(self):
from os.path import join, expanduser, lexists
dirname = join(self.fm.thisdir.path, expanduser(self.rest(1)))
if not lexists(dirname):
self.fm.mkdir(dirname)
if lexists(dirname):
self.fm.thisdir.load_content(schedule=False)
self.fm.select_file(dirname)
else:
self.fm.notify("Failed to mkdir!", bad=True)
else:
self.fm.notify("file/directory exists!", bad=True)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.