diff --git a/kitty/launcher/cli-parser.h b/kitty/launcher/cli-parser.h index 11dabc3ac..7e7efb680 100644 --- a/kitty/launcher/cli-parser.h +++ b/kitty/launcher/cli-parser.h @@ -359,18 +359,18 @@ output_argv(const char *name, int argc, char **argv) { static void output_values_for_testing(CLISpec *spec) { value_map_for_loop(&spec->value_map) { - printf("%s: ", itr.data->key); CLIValue v = itr.data->val; switch (v.type) { case CLI_VALUE_STRING: case CLI_VALUE_CHOICE: - printf("%s", v.strval ? v.strval : ""); break; + printf("%s: %s", itr.data->key, v.strval ? v.strval : ""); break; case CLI_VALUE_BOOL: - printf("%d", v.boolval); break; + printf("%s: %d", itr.data->key, v.boolval); break; case CLI_VALUE_INT: - printf("%lld", v.intval); break; + printf("%s: %lld", itr.data->key, v.intval); break; case CLI_VALUE_FLOAT: - printf("%f", v.floatval); break; + printf("%s: %f", itr.data->key, v.floatval); break; case CLI_VALUE_LIST: + output_argv(itr.data->key, v.listval.count, (char**)v.listval.items); break; } printf("\n"); diff --git a/kitty_tests/options.py b/kitty_tests/options.py index 73643d007..b3c8432f5 100644 --- a/kitty_tests/options.py +++ b/kitty_tests/options.py @@ -126,6 +126,7 @@ def t(args, leftover=(), fails=False, version_called=False, help_called=False, * def launcher(self): kexe = kitty_exe() + cfgdir = os.path.join(os.environ['XDG_CONFIG_HOME'], 'kitty') def get_report(cmdline: str, launch_services= False): args = list(shlex_split(cmdline)) env = dict(os.environ) @@ -141,7 +142,7 @@ def get_report(cmdline: str, launch_services= False): key, val = line.split(':') except ValueError: raise AssertionError(f'Unexpected output from launcher: {line!r}\n{cp.stdout.decode()}') - if key in ('argv', 'original_argv', 'open_urls'): + if '\x1e' in val: val = [x for x in val.split('\x1e') if x] else: val = val.strip() @@ -155,7 +156,7 @@ def test(cmdline, assertions): def t(cmdline, **assertions): assertions['is_quick_access_terminal'] = '0' - assertions['config_dir'] = os.path.join(os.environ['XDG_CONFIG_HOME'], 'kitty') + assertions['config_dir'] = cfgdir assertions.setdefault('launched_by_launch_services', '0') test(cmdline, assertions) @@ -182,7 +183,8 @@ def pn(cmdline, **assertions): test(cmdline, assertions) t('', original_argv=[kexe], argv=[]) - t('--title=xxx cat', title='xxx', original_argv=[kexe, '--title=xxx', 'cat'], argv=['cat']) + t('--title=xxx --start-as maximized -c=a -c b cat', title='xxx', start_as='maximized', config=['a', 'b'], original_argv=[ + kexe, '--title=xxx', '--start-as', 'maximized', '-c=a', '-c', 'b', 'cat'], argv=['cat']) k('icat abc xyz') t('+kitten unwrapped xyz', argv=['+kitten', 'unwrapped', 'xyz']) t('+ kitten unwrapped xyz', original_argv=[kexe, '+', 'kitten', 'unwrapped', 'xyz'])