Skip to content

For the builtin history delete: The searchterm can be interpreted as an option #8853

@ghost

Description

If you want to remove an history item (-a or -x or whatever):

  1. history delete --exact --case-sensitive -a # Interpreted as an option for history
  2. history delete --exact --case-sensitive '-a' # The same
  3. history delete --exact --case-sensitive -- -a # The same
  4. history delete --exact --case-sensitive -- '-a' # The same

Instead, you need to write, for it works:
5) history delete --exact --case-sensitive -- -- -a # or '-a'

Fix:
In /share/functions/history.fish (line:122):

  • builtin history delete $search_mode $_flag_case_sensitive $searchterm
  • builtin history delete $search_mode $_flag_case_sensitive -- $searchterm

Info:
The command "history delete", that ask the user for a "Search term: "
Doesn't produce an error (you can enter -a or -x, and the deletion in history is working)

Of course, it's simplier to use the command: "history delete" and enter your searchterm than manually add options.
But the problem occurs when you use the fisher plugin andreiborisov/sponge which auto-delete history entries that returned an error (like -x or -m) at prompt launching.

Fish version: 3.4.0
OS: Debian 11

  • The problem occurs also without third-party customizations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions