From 42b6e4bf14fa237ea9fcd515e07aaad877271035 Mon Sep 17 00:00:00 2001 From: Jeff LANCE Date: Thu, 22 Feb 2024 17:19:39 +0100 Subject: [PATCH] Update home/.config/ranger/command.py --- home/dot_config/ranger/command.py | 88 +++++-------------------------- 1 file changed, 13 insertions(+), 75 deletions(-) diff --git a/home/dot_config/ranger/command.py b/home/dot_config/ranger/command.py index 250a9de..d099ced 100644 --- a/home/dot_config/ranger/command.py +++ b/home/dot_config/ranger/command.py @@ -6,81 +6,7 @@ # Last Modified Date: 12.05.2021 # Last Modified By : Jeff LANCE -import os -from ranger.core.loader import CommandLoader -from ranger_udisk_menu.mounter import mount - - -# class extract_here(Command): -# def execute(self): -# """extract selected files to current directory.""" -# cwd = self.fm.thisdir -# marked_files = tuple(cwd.get_selection()) - -# def refresh(_): -# cwd = self.fm.get_directory(original_path) -# cwd.load_content() - -# one_file = marked_files[0] -# cwd = self.fm.thisdir -# original_path = cwd.path -# au_flags = ["-x", cwd.path] -# au_flags += self.line.split()[1:] -# au_flags += ["-e"] - -# self.fm.copy_buffer.clear() -# self.fm.cut_buffer = False -# if len(marked_files) == 1: -# descr = "extracting: " + os.path.basename(one_file.path) -# else: -# descr = "extracting files from: " + os.path.basename(one_file.dirname) -# obj = CommandLoader( -# args=["aunpack"] + au_flags + [f.path for f in marked_files], -# descr=descr, -# read=True, -# ) - -# obj.signal_bind("after", refresh) -# self.fm.loader.add(obj) - - -# class compress(Command): -# def execute(self): -# """Compress marked files to current directory""" -# cwd = self.fm.thisdir -# marked_files = cwd.get_selection() - -# if not marked_files: -# return - -# def refresh(_): -# cwd = self.fm.get_directory(original_path) -# cwd.load_content() - -# original_path = cwd.path -# parts = self.line.split() -# au_flags = parts[1:] - -# descr = "compressing files in: " + os.path.basename(parts[1]) -# obj = CommandLoader( -# args=["apack"] -# + au_flags -# + [os.path.relpath(f.path, cwd.path) for f in marked_files], -# descr=descr, -# read=True, -# ) - -# obj.signal_bind("after", refresh) -# self.fm.loader.add(obj) - -# def tab(self, tabnum): -# """Complete with current folder name""" - -# extension = [".zip", ".tar.gz", ".rar", ".7z"] -# return [ -# "compress " + os.path.basename(self.fm.thisdir.path) + ext -# for ext in extension -# ] +from ranger.api.commands import Command class mkcd(Command): @@ -116,3 +42,15 @@ class mkcd(Command): self.fm.execute_console("scout -ae ^{}$".format(s)) else: self.fm.notify("file/directory exists!", bad=True) + + +class tmsu_tag(Command): + """:tmsu_tag + + Tags the current file with tmsu + """ + + def execute(self): + cf = self.fm.thisfile + + self.fm.run('tmsu tag "{0}" {1}'.format(cf.basename, self.rest(1)))