Fix to allow specifying an initial tab in fish_config

For example, you can run "fish_config history"
This commit is contained in:
ridiculousfish 2012-07-27 13:40:43 -07:00
parent e7cbcc83a4
commit f6b76e6ecb
3 changed files with 32 additions and 4 deletions

View file

@ -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

View file

@ -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)
})
</script>

View file

@ -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)