Rename url_hints to just hints
This commit is contained in:
parent
32caea4197
commit
808750a76a
@ -32,10 +32,10 @@ def launch(args):
|
|||||||
|
|
||||||
|
|
||||||
def run_kitten(args):
|
def run_kitten(args):
|
||||||
import runpy
|
|
||||||
kitten = args[1]
|
kitten = args[1]
|
||||||
sys.argv = args[1:]
|
sys.argv = args[1:]
|
||||||
runpy.run_module('kittens.{}.main'.format(kitten), run_name='__main__')
|
from kittens.runner import run_kitten
|
||||||
|
run_kitten(kitten)
|
||||||
|
|
||||||
|
|
||||||
def namespaced(args):
|
def namespaced(args):
|
||||||
|
|||||||
@ -8,6 +8,12 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
aliases = {'url_hints': 'hints'}
|
||||||
|
|
||||||
|
|
||||||
|
def resolved_kitten(k):
|
||||||
|
return aliases.get(k, k)
|
||||||
|
|
||||||
|
|
||||||
def import_kitten_main_module(config_dir, kitten):
|
def import_kitten_main_module(config_dir, kitten):
|
||||||
if kitten.endswith('.py'):
|
if kitten.endswith('.py'):
|
||||||
@ -24,18 +30,21 @@ def import_kitten_main_module(config_dir, kitten):
|
|||||||
exec(code, g)
|
exec(code, g)
|
||||||
return {'start': g['main'], 'end': g['handle_result']}
|
return {'start': g['main'], 'end': g['handle_result']}
|
||||||
else:
|
else:
|
||||||
|
kitten = resolved_kitten(kitten)
|
||||||
m = importlib.import_module('kittens.{}.main'.format(kitten))
|
m = importlib.import_module('kittens.{}.main'.format(kitten))
|
||||||
return {'start': m.main, 'end': m.handle_result}
|
return {'start': m.main, 'end': m.handle_result}
|
||||||
|
|
||||||
|
|
||||||
def create_kitten_handler(kitten, orig_args):
|
def create_kitten_handler(kitten, orig_args):
|
||||||
from kitty.constants import config_dir
|
from kitty.constants import config_dir
|
||||||
|
kitten = resolved_kitten(kitten)
|
||||||
m = import_kitten_main_module(config_dir, kitten)
|
m = import_kitten_main_module(config_dir, kitten)
|
||||||
return partial(m['end'], [kitten] + orig_args)
|
return partial(m['end'], [kitten] + orig_args)
|
||||||
|
|
||||||
|
|
||||||
def launch(args):
|
def launch(args):
|
||||||
config_dir, kitten = args[:2]
|
config_dir, kitten = args[:2]
|
||||||
|
kitten = resolved_kitten(kitten)
|
||||||
del args[:2]
|
del args[:2]
|
||||||
args = [kitten] + args
|
args = [kitten] + args
|
||||||
os.environ['KITTY_CONFIG_DIRECTORY'] = config_dir
|
os.environ['KITTY_CONFIG_DIRECTORY'] = config_dir
|
||||||
@ -50,6 +59,12 @@ def launch(args):
|
|||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
|
def run_kitten(kitten):
|
||||||
|
import runpy
|
||||||
|
kitten = resolved_kitten(kitten)
|
||||||
|
runpy.run_module('kittens.{}.main'.format(kitten), run_name='__main__')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
|
|||||||
@ -434,11 +434,11 @@ map ctrl+shift+u input_unicode_character
|
|||||||
map ctrl+shift+f2 edit_config_file
|
map ctrl+shift+f2 edit_config_file
|
||||||
# Open a currently visible URL using the keyboard. The program used to open the
|
# Open a currently visible URL using the keyboard. The program used to open the
|
||||||
# URL is specified in open_url_with. You can customize how the URLs are
|
# URL is specified in open_url_with. You can customize how the URLs are
|
||||||
# detected and opened by specifying command line options to url_hints. The
|
# detected and opened by specifying command line options to hints. The
|
||||||
# special value of - for --program will cause the selected URL to be inserted
|
# special value of - for --program will cause the selected URL to be inserted
|
||||||
# into the terminal. For example:
|
# into the terminal. For example:
|
||||||
# map ctrl+shift+e run_kitten text url_hints --program firefox --regex "http://[^ ]+"
|
# map ctrl+shift+e run_kitten text hints --program firefox --regex "http://[^ ]+"
|
||||||
map ctrl+shift+e run_kitten text url_hints
|
map ctrl+shift+e run_kitten text hints
|
||||||
# Open the kitty shell in a new window/tab/overlay/os_window to control kitty using commands.
|
# Open the kitty shell in a new window/tab/overlay/os_window to control kitty using commands.
|
||||||
map ctrl+shift+escape kitty_shell window
|
map ctrl+shift+escape kitty_shell window
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user