From f6b76e6ecb472fe94a7b8292e70f43819ed46c98 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Fri, 27 Jul 2012 13:40:43 -0700 Subject: [PATCH] Fix to allow specifying an initial tab in fish_config For example, you can run "fish_config history" --- share/functions/fish_config.fish | 7 ++++++- share/tools/web_config/index.html | 18 +++++++++++++++++- share/tools/web_config/webconfig.py | 11 +++++++++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/share/functions/fish_config.fish b/share/functions/fish_config.fish index de59d8343..10f15f096 100644 --- a/share/functions/fish_config.fish +++ b/share/functions/fish_config.fish @@ -1,3 +1,8 @@ function fish_config --description "Launch fish's web based configuration" - eval $__fish_datadir/tools/web_config/webconfig.py + # Support passing an initial tab like "colors" or "functions" + set -l initial_tab + if test (count $argv) > 0 + set initial_tab $argv[1] + end + eval $__fish_datadir/tools/web_config/webconfig.py $initial_tab end diff --git a/share/tools/web_config/index.html b/share/tools/web_config/index.html index b61a7e7ac..d29f179bf 100644 --- a/share/tools/web_config/index.html +++ b/share/tools/web_config/index.html @@ -1189,7 +1189,23 @@ function update_table_filter_text_box(allow_transient_message) { $(document).ready(function() { populate_colorpicker_term256() - switch_tab('tab_colors') + var tab_name + switch (window.location.hash) { + case '#functions': + tab_name = 'tab_functions' + break + case '#variables': + tab_name = 'tab_variables' + break + case '#history': + tab_name = 'tab_history' + break + case '#colors': + default: + tab_name = 'tab_colors' + break; + } + switch_tab(tab_name) }) diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index ce1b701a7..cf004719d 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -374,9 +374,16 @@ if PORT > 9000: print("Unable to find an open port between 8000 and 9000") sys.exit(-1) - -url = 'http://localhost:{0}'.format(PORT) +# Get any initial tab (functions, colors, etc) +# Just look at the first letter +initial_tab = '' +if len(sys.argv) > 1: + for tab in ['functions', 'colors', 'variables', 'history']: + if tab.startswith(sys.argv[1]): + initial_tab = '#' + tab + break +url = 'http://localhost:{0}/{1}'.format(PORT, initial_tab) print("Web config started at '{0}'. Hit enter to stop.".format(url)) webbrowser.open(url)