Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

A use case for status get-file #12861

Copy link
Copy link

Description

@IsaacOscar
Issue body actions

Im reporting my use case here as requested by the documentation.

Bassically I'm using it to extend some of the functionality of fishes included functions, without having to rewrite them entirely.

Specifically, I'm currently using it twice:

In my ~/.config/fish/functions/ls.fish:

status get-file functions/ls.fish | source
# in previous fish versions, I did:
# source $__fish_data_dir/functions/ls.fish

functions -c ls __fish_ls
function ls; __fish_ls -A $argv; end

Thus ls gives fishes default behaviour, but also an implicit -A. (if I just did function ls; command ls -A $argv; end, I'd lose the nice colour coding that fish adds).

I also have a ~/.config/fish/completions/git.fish file:

status get-file completions/git.fish | source

# declares a completion for a new git sub command that takes no arguments 
function complete-basic -a new description
    complete -c git -n __fish_git_needs_command -a $new -d "$description"
end

#declares a completion for a new subcommand that takes the same arguments as original.
function complete-alias -a original new description
    complete-basic $new $description
    for C in (complete -c git | string match -re "__fish_git_using_command[^']*"$original"[ ']")
        eval (string replace -r "__fish_git_using_command" "__fish_git_using_command $new" $C)
    end
end

# abort and mend are  defined in my ~/.gitconfig [alias] section
complete-basic abort "Undo the current sequencer process"
complete-alias commit mend "Ammend the prior commit"

... # many other aliases

The above uses status get-file to load the existing completions, as well as the helper __fish_git functions.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.