Skip to content

Commit

Permalink
1.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
yo-goto committed Feb 6, 2022
1 parent b85bddd commit 638b1ee
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- v1.7.5
- New feature
- fin: new option `--list` can be used to see the list of all URLs & site names
- v1.7.4
- New feature
- new subcommand to `fin` : fish
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ Options:
-v, --version Show version info
-h, --help Show help
-d, --debug Show debug tests
--list Show the list of all urls & sites
Subcommands:
[base] g(ggl) help
[basic] youtube github stackoverflow
Expand All @@ -293,7 +294,7 @@ Subcommands:
[other] codepen
```

`fin` offers the completions of all of these subcommands. After typing `fin` & a space character, use `tab` key, then you can see the list of all subcommands.
`fin` offers the completions of all of these subcommands. After typing `fin` & a space character, use `tab` key, then you can see the list of all subcommands (or use `-l` or `--list` option flags).

To see help, use `-h` or `--help` option flags (`fin help` is also available). To see the `ggl` command options, execute `fin g -h`.
If you want to add some options familiar to frontend dev, you can create a pull request. I'm planning to add more options.
Expand Down
1 change: 1 addition & 0 deletions completions/fin.fish
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
complete -c fin -s v -l version -f -d 'Show version info'
complete -c fin -s h -l help -f -d "Show help"
complete -c fin -s d -l debug -f -d "Show debug tests"
complete -c fin -l list -f -d "Show the list of all urls & sites"

complete fin -x -n __fish_use_subcommand -a help -d "Show help"
complete fin -x -n __fish_use_subcommand -a ggl -d "Use ggl"
Expand Down
75 changes: 71 additions & 4 deletions functions/fin.fish
Original file line number Diff line number Diff line change
@@ -1,52 +1,107 @@
function fin --description "ggl wrapper for frontend developers"
argparse --stop-nonopt 'v/version' 'h/help' 'd/debug' -- $argv
argparse --stop-nonopt 'v/version' 'h/help' 'd/debug' 'list' -- $argv

set --local version_fin "v0.0.7"

set --local version_fin "v0.0.6"
# color shortcut
set --local cc (set_color $_ggl_color)
set --local cn (set_color normal)
set --local ca (set_color $_ggl_color_accent)
set --local co (set_color $_ggl_color_other)
set --local cn (set_color normal)

# query exists
set --local param_url
set --local base_url
set --local list_url
set --local list_url_cmd
# query doesn't exist
set --local param_site
set --local list_site
set --local list_site_cmd

# url list
## also available from ggl command
set --local url_youtube "https://www.youtube.com/results?search_query="
set --local base_youtube "https://www.youtube.com"
set -a list_url $url_youtube
set -a list_url_cmd "youtube"
set --local url_github "https://github.com/search?q="
set --local base_github "https://github.com"
set -a list_url $url_github
set -a list_url_cmd "github"
set --local url_stackoverflow "https://stackoverflow.com/search?q="
set --local base_stackoverflow "https://stackoverflow.com"
set -a list_url $url_stackoverflow
set -a list_url_cmd "stackoverflow"
set --local url_zenn "https://zenn.dev/search?q="
set --local base_zenn "https://zenn.dev"
set -a list_url $url_zenn
set -a list_url_cmd "zenn"
set --local url_qiita "https://qiita.com/search?q="
set --local base_qiita "https://qiita.com"
set -a list_url $url_qiita
set -a list_url_cmd "qiita"
set --local url_fish "https://fishshell.com/docs/current/search.html?q="
set --local base_fish "https://fishshell.com/docs/current/index.html"
set -a list_url $url_fish
set -a list_url_cmd "fish"

## fin specific
set --local url_mdn "https://developer.mozilla.org/search?q="
set --local base_mdn "https://developer.mozilla.org"
set -a list_url $url_mdn
set -a list_url_cmd "mdn"
set --local url_angular "https://angular.io/docs/ts/latest/api/#!?url="
set --local base_angular "https://angular.io/docs/ts/latest/api"
set -a list_url $url_angular
set -a list_url_cmd "angluar"
set --local url_codepen "http://codepen.io/search?q="
set --local base_codepen "http://codepen.io"
set -a list_url $url_codepen
set -a list_url_cmd "codepen"
set --local url_npm "https://www.npmjs.com/search?q="
set --local base_npm "https://www.npmjs.com"
set -a list_url $url_npm
set -a list_url_cmd "npm"
set --local url_emojipedia "https://emojipedia.org/search/?q="
set --local base_emojipedia "https://emojipedia.org"
set -a list_url $url_emojipedia
set -a list_url_cmd "emojipedia"
set --local url_rust "https://doc.rust-lang.org/reference/index.html?search="
set --local base_rust "https://doc.rust-lang.org/reference"
set -a list_url $url_rust
set -a list_url_cmd "rust"

# site list (no query)
set --local site_node "nodejs.org"
set -a list_site $site_node
set -a list_site_cmd "node"
set --local site_deno "deno.land"
set -a list_site $site_deno
set -a list_site_cmd "deno"
set --local site_vue "vuejs.org"
set -a list_site $site_vue
set -a list_site_cmd "vue"
set --local site_react "reactjs.org"
set -a list_site $site_react
set -a list_site_cmd "react"
set --local site_typescript "typescriptlang.org"
set -a list_site $site_typescript
set -a list_site_cmd "typescript"
set --local site_storybook "storybook.js.org"
set -a list_site $site_storybook
set -a list_site_cmd "storybook"
set --local site_bem "en.bem.info"
set -a list_site $site_bem
set -a list_site_cmd "bem"
set --local site_nextjs "nextjs.org"
set -a list_site $site_nextjs
set -a list_site_cmd "nextjs"
set --local site_yarn "yarnpkg.com"
set -a list_site $site_yarn
set -a list_site_cmd "yarn"

# option handling
if set -q _flag_version
functions --query ggl; and \
eval ggl -v
Expand All @@ -58,8 +113,19 @@ function fin --description "ggl wrapper for frontend developers"
else if set -q _flag_debug
_fin_debug
return
else if set -q _flag_list
echo $cc"[Query exists]" $cn
for i in (seq (count $list_url))
echo ""$ca $list_url_cmd[$i]':'$co $list_url[$i] $cn
end
echo $cc"[Query doesn't exist]" $cn
for i in (seq (count $list_site))
echo ""$ca $list_site_cmd[$i]':'$co $list_site[$i] $cn
end
return
end


# main
if functions --query ggl
set --local ts (string join "" "$argv")
if set -q url_$argv[1] && test -n "$ts"
Expand Down Expand Up @@ -119,6 +185,7 @@ function _fin_help
echo ' -v, --version Show version info'
echo ' -h, --help Show help'
echo ' -d, --debug Show debug tests'
echo ' --list Show the list of all urls & sites'
echo 'Subcommands:'
echo ' [base] g(ggl) help'
echo ' [basic] youtube github stackoverflow'
Expand Down
2 changes: 1 addition & 1 deletion functions/ggl.fish
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function ggl --description "A simple search plugin for keywords on Google"
-- $argv
or return

set --local version_plugin "v1.7.4"
set --local version_plugin "v1.7.5"
set --local version_ggl "v1.6.7"
## color
set --local cc (set_color $_ggl_color)
Expand Down

0 comments on commit 638b1ee

Please sign in to comment.