Skip to content

simple fish plugin to source all fish files under the current project or config directory

License

Notifications You must be signed in to change notification settings

yo-goto/source-fish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

source-fish 🍣🥢

This is a simple fish plugin to source all fish files in functions, completions, and conf.d directories under the current directory. Use this plugin for testing your fish plugin. You can also source fish files in the config directory (usually ~/.config/fish).

I changed the previous repo & command name "tsc.fish" to "source-fish" for avoiding conflict against the TypeScript compiler command "tsc".

Installation 🎣

Using fisher:

fisher install yo-goto/source-fish

Update

fisher update yo-goto/source-fish

Usage 🔦

USAGE:
      source-fish [OPTION]
      source-fish DIRECOTRIES...
OPTIONS:
      -v, --version   Show version info
      -h, --help      Show help
      -p, --permit    Source fish files without confirmation
      -r, --recent    Find recently modified files (within 1 hour) & source them
      -a, --all       Source all fish files under the current directory
      -t, --test      Source all fish files in the "test" folder
      -c, --config    Source fish files in the config directory

If your current directory structure is like this, source-fish finds all fish files in comptions, functions and conf.d directories, and then source them at once. (My ggl.fish plugin directory structure ↓)

.
├── CHANGELOG.md
├── LICENSE
├── README.md
├── completions
│   ├── fin.fish
│   └── ggl.fish
├── conf.d
│   └── ggl.fish
└── functions
    ├── fin.fish
    └── ggl.fish
source-fish
Current: /Users/userName/Documents/ALL-Repo/ggl.fish
Source fish files in this project? [Y/n]: y
-->completed: ./functions/ggl.fish
-->completed: ./functions/fin.fish
-->completed: ./completions/ggl.fish
-->completed: ./completions/fin.fish
-->completed: ./conf.d/ggl.fish

You can also source all fish files inside the specific directories under the current directory using arguments. After source-fish , use the Tab key to show auto-suggestions.

source-fish functions/ conf.d/
found fish files:
./functions/ggl.fish
./functions/fin.fish
./conf.d/ggl.fish
Source these fish files? [Y/n]: y
-->complete: ./functions/ggl.fish
-->complete: ./functions/fin.fish
-->complete: ./conf.d/ggl.fish

From v0.2.0, you can use "permit" option with -p or --permit option flags. With this option, you can source fish files immediatly.

# default sourcesource-fish -p
-->completed: ./functions/source-fish.fish
-->completed: ./completions/source-fish.fish
# for test directorysource-fish -tp
-->completed: ./test/mytest.fish
-->completed: ./test/simple.fish
-->completed: ./tests/bool.fish
-->completed: ./tests/numtest.fish
-->completed: ./tests/combi.fish
-->completed: ./tests/sometest.fish
# for recently modified files (within 1 hour)source-fish -rp
-->completed: ./tests/combi.fish
-->completed: ./functions/source-fish.fish

You can also source bulk fish files in the config direcotry (to check your config dir, use echo $__fish_config_dir). To do so, use -c or --config option flag. In this option mode, you can interactively select a directory to source.

source-fish -c
Config [r/recent | a/all | d/dir | e/exit]: d
Directory [t/top | c/conf | f/functons | p/completions | b/back | e/exit ]: p
Source? [y/yes | r/result&source | p/print | b/back | e/exit ]: p
-->found: /Users/roshi/.config/fish/completions/ggl.fish
-->found: /Users/roshi/.config/fish/completions/tide.fish
-->found: /Users/roshi/.config/fish/completions/fish_logo.fish
-->found: /Users/roshi/.config/fish/completions/source-fish.fish
-->found: /Users/roshi/.config/fish/completions/fishtape.fish
-->found: /Users/roshi/.config/fish/completions/fin.fish
-->found: /Users/roshi/.config/fish/completions/to.fish
Source? [y/yes | r/result&source | p/print | b/back | e/exit ]: r
-->completed: /Users/roshi/.config/fish/completions/ggl.fish
-->completed: /Users/roshi/.config/fish/completions/tide.fish
-->completed: /Users/roshi/.config/fish/completions/fish_logo.fish
-->completed: /Users/roshi/.config/fish/completions/source-fish.fish
-->completed: /Users/roshi/.config/fish/completions/fishtape.fish
-->completed: /Users/roshi/.config/fish/completions/fin.fish
-->completed: /Users/roshi/.config/fish/completions/to.fish

In the first question, you can select options to source directories. r/recent finds reacently modified files (within 1 hour). a/all finds all fish files in the config directory.

In the second question, you can check the selected fish files with p or print without sourcing. To source files and check the results at the same time, type y or yes. To source them without printing results, type q or quiet. To go back to select config, type b or back. Typing s or source results in sourcing fish files in the selected directory without printing results.

Change Log 🔖

About

simple fish plugin to source all fish files under the current project or config directory

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages