Skip to content

fish_config theme save returns "Too few arguments" #9088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
agingorange opened this issue Jul 23, 2022 · 2 comments · Fixed by #9273
Closed

fish_config theme save returns "Too few arguments" #9088

agingorange opened this issue Jul 23, 2022 · 2 comments · Fixed by #9273
Milestone

Comments

@agingorange
Copy link

fish 3.5.0 on macOS Big Sur 11.6.7

Basically, I'm following the example from https://fishshell.com/docs/current/faq.html#how-do-i-customize-my-syntax-highlighting-colors

fish_config theme show works
fish_config theme choose [name_of_theme] works
fish_config theme save returns "Too few arguments"

mqudsi added a commit to mqudsi/fish-shell that referenced this issue Oct 13, 2022
The documentation states that running `fish_config theme save` after
`fish_config theme choose [theme_name]` will result in "saving" the
currently chosen theme, but this does not match the actual behavior of
`fish_config theme save` which expects a trailing argument specifying
the name of the theme to select/persist.

Given that the documented way has been included in a release and that it
makes more sense than calling `fish_config theme save xxx` when you are
*loading from* xxx and not *saving to* xxx, this patch revises
`fish_config.fish` to support the documented behavior.

When `fish_config theme choose xxx` is used, xxx is saved to a hidden
global variable `__fish_last_chosen_theme`. If `fish_config theme save`
is called without a theme name specified, then this global variable is
searched for the name of the last chosen theme and that is
saved/persisted as the default theme.

Closes fish-shell#9088.
@mqudsi
Copy link
Contributor

mqudsi commented Oct 13, 2022

As far as I can tell, the documentation is wrong here because from my reading of fish_config.fish, fish_config theme save xxx is to replace the theme of name xxx with the current/active theme colors/config.

At first I thought fish_config.fish just conflated the arg count for fish_config theme choose with fish_config theme save because they were being handled in the same block, but it seems that fish_config theme save is something entirely different from what the docs intend at this step.

mqudsi added a commit to mqudsi/fish-shell that referenced this issue Oct 14, 2022
The documentation states that running `fish_config theme save` after
`fish_config theme choose [theme_name]` will result in "saving" the
currently chosen theme, but this does not match the actual behavior of
`fish_config theme save` which expects a trailing argument specifying
the name of the theme to select/persist.

Given that the documented way has been included in a release and that it
makes more sense than calling `fish_config theme save xxx` when you are
*loading from* xxx and not *saving to* xxx, this patch revises
`fish_config.fish` to support the documented behavior.

When `fish_config theme save xxx` is used, xxx is loaded w/ its specified colors
saved to the according variables in the universal scope. But if `fish_config
theme save` is used without a theme's name specified, then the currently
specified (known) fish color variables are persisted from whatever scope they're
currently in (usually in the global scope from previewing a theme) to universal
variables of the same name.

This does *not* catch color variables unknown to fish! If a theme and a
prompt agree on some variable to hold some color but it's not a color variable
known to fish, it won't be persisted!

Closes fish-shell#9088.
mqudsi added a commit to mqudsi/fish-shell that referenced this issue Oct 14, 2022
The documentation states that running `fish_config theme save` after
`fish_config theme choose [theme_name]` will result in "saving" the
currently chosen theme, but this does not match the actual behavior of
`fish_config theme save` which expects a trailing argument specifying
the name of the theme to select/persist.

Given that the documented way has been included in a release and that it
makes more sense than calling `fish_config theme save xxx` when you are
*loading from* xxx and not *saving to* xxx, this patch revises
`fish_config.fish` to support the documented behavior.

When `fish_config theme save xxx` is used, xxx is loaded w/ its specified colors
saved to the according variables in the universal scope. But if `fish_config
theme save` is used without a theme's name specified, then the currently
specified (known) fish color variables are persisted from whatever scope they're
currently in (usually in the global scope from previewing a theme) to universal
variables of the same name.

This does *not* catch color variables unknown to fish! If a theme and a
prompt agree on some variable to hold some color but it's not a color variable
known to fish, it won't be persisted!

Closes fish-shell#9088.
mqudsi added a commit to mqudsi/fish-shell that referenced this issue Oct 14, 2022
The documentation states that running `fish_config theme save` after
`fish_config theme choose [theme_name]` will result in "saving" the
currently chosen theme, but this does not match the actual behavior of
`fish_config theme save` which expects a trailing argument specifying
the name of the theme to select/persist.

Given that the documented way has been included in a release and that it
makes more sense than calling `fish_config theme save xxx` when you are
*loading from* xxx and not *saving to* xxx, this patch revises
`fish_config.fish` to support the documented behavior.

When `fish_config theme choose xxx` is used, xxx is saved to a hidden
global variable `__fish_last_chosen_theme`. If `fish_config theme save`
is called without a theme name specified, then this global variable is
searched for the name of the last chosen theme and that is
saved/persisted as the default theme.

Closes fish-shell#9088.
mqudsi added a commit to mqudsi/fish-shell that referenced this issue Oct 14, 2022
The documentation states that running `fish_config theme save` after
`fish_config theme choose [theme_name]` will result in "saving" the
currently chosen theme, but this does not match the actual behavior of
`fish_config theme save` which expects a trailing argument specifying
the name of the theme to select/persist.

Given that the documented way has been included in a release and that it
makes more sense than calling `fish_config theme save xxx` when you are
*loading from* xxx and not *saving to* xxx, this patch revises
`fish_config.fish` to support the documented behavior.

When `fish_config theme save xxx` is used, xxx is loaded w/ its specified colors
saved to the according variables in the universal scope. But if `fish_config
theme save` is used without a theme's name specified, then the currently
specified (known) fish color variables are persisted from whatever scope they're
currently in (usually in the global scope from previewing a theme) to universal
variables of the same name.

This does *not* catch color variables unknown to fish! If a theme and a
prompt agree on some variable to hold some color but it's not a color variable
known to fish, it won't be persisted!

Closes fish-shell#9088.
mqudsi added a commit to mqudsi/fish-shell that referenced this issue Oct 22, 2022
The documentation states that running `fish_config theme save` after
`fish_config theme choose [theme_name]` will result in "saving" the
currently chosen theme, but this does not match the actual behavior of
`fish_config theme save` which expects a trailing argument specifying
the name of the theme to select/persist.

Given that the documented way has been included in a release and that it
makes more sense than calling `fish_config theme save xxx` when you are
*loading from* xxx and not *saving to* xxx, this patch revises
`fish_config.fish` to support the documented behavior.

When `fish_config theme choose xxx` is used, xxx is saved to a hidden
global variable `__fish_last_chosen_theme`. If `fish_config theme save`
is called without a theme name specified, then this global variable is
searched for the name of the last chosen theme and that is
saved/persisted as the default theme.

Closes fish-shell#9088.
mqudsi added a commit to mqudsi/fish-shell that referenced this issue Oct 22, 2022
The documentation states that running `fish_config theme save` after
`fish_config theme choose [theme_name]` will result in "saving" the
currently chosen theme, but this does not match the actual behavior of
`fish_config theme save` which expects a trailing argument specifying
the name of the theme to select/persist.

Given that the documented way has been included in a release and that it
makes more sense than calling `fish_config theme save xxx` when you are
*loading from* xxx and not *saving to* xxx, this patch revises
`fish_config.fish` to support the documented behavior.

When `fish_config theme save xxx` is used, xxx is loaded w/ its specified colors
saved to the according variables in the universal scope. But if `fish_config
theme save` is used without a theme's name specified, then the currently
specified (known) fish color variables are persisted from whatever scope they're
currently in (usually in the global scope from previewing a theme) to universal
variables of the same name.

This does *not* catch color variables unknown to fish! If a theme and a
prompt agree on some variable to hold some color but it's not a color variable
known to fish, it won't be persisted!

Closes fish-shell#9088.
mqudsi added a commit to mqudsi/fish-shell that referenced this issue Oct 22, 2022
The documentation states that running `fish_config theme save` after
`fish_config theme choose [theme_name]` will result in "saving" the
currently chosen theme, but this does not match the actual behavior of
`fish_config theme save` which expects a trailing argument specifying
the name of the theme to select/persist.

Given that the documented way has been included in a release and that it
makes more sense than calling `fish_config theme save xxx` when you are
*loading from* xxx and not *saving to* xxx, this patch revises
`fish_config.fish` to support the documented behavior.

When `fish_config theme save xxx` is used, xxx is loaded w/ its specified colors
saved to the according variables in the universal scope. But if `fish_config
theme save` is used without a theme's name specified, then the currently
specified (known) fish color variables are persisted from whatever scope they're
currently in (usually in the global scope from previewing a theme) to universal
variables of the same name.

This does *not* catch color variables unknown to fish! If a theme and a
prompt agree on some variable to hold some color but it's not a color variable
known to fish, it won't be persisted!

Closes fish-shell#9088.
mqudsi added a commit that referenced this issue Oct 22, 2022
Fix `fish_config theme save` without trailing theme name. Fixes #9088.
@mqudsi
Copy link
Contributor

mqudsi commented Oct 22, 2022

This is fixed for the next release. If we ever do a minor release for 3.5.x we can consider backporting it as well.

@mqudsi mqudsi added this to the fish 3.6.0 milestone Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants