Coder Social home page Coder Social logo

yo-goto / source-fish Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 46 KB

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

License: MIT License

Shell 100.00%
fish fish-shell fish-plugin fish-plugins fish-functions

source-fish's Introduction

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 source
โฏ source-fish -p
-->completed: ./functions/source-fish.fish
-->completed: ./completions/source-fish.fish
# for test directory
โฏ source-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 ๐Ÿ”–

source-fish's People

Contributors

yo-goto avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

holly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.