Selaa lähdekoodia

shell completions for `rebar3 path'

pull/761/head
alisdair sullivan 9 vuotta sitten
vanhempi
commit
04da2ffd5e
5 muutettua tiedostoa jossa 41 lisäystä ja 5 poistoa
  1. +1
    -0
      README.md
  2. +12
    -0
      priv/shell-completion/bash/rebar3
  3. +12
    -0
      priv/shell-completion/fish/rebar3.fish
  4. +11
    -0
      priv/shell-completion/zsh/_rebar3
  5. +5
    -5
      src/rebar_prv_path.erl

+ 1
- 0
README.md Näytä tiedosto

@ -35,6 +35,7 @@ locations ([hex.pm](http://hex.pm), git, hg, and so on).
| eunit | Run eunit tests |
| help | Print help for rebar or task |
| new | Create new rebar project from templates |
| path | Print paths to build dirs in current profile |
| pkgs | List available packages |
| plugins | List or upgrade plugins |
| release | Build release of project |

+ 12
- 0
priv/shell-completion/bash/rebar3 Näytä tiedosto

@ -23,6 +23,7 @@ _rebar3()
eunit \
help \
new \
path \
pkgs \
plugins \
release \
@ -98,6 +99,17 @@ _rebar3()
elif [[ ${prev} == new ]] ; then
sopts="-f"
lopts="--force"
elif [[ ${prev} == path ]] ; then
sopts="-s"
lopts="--app \
--base \
--bin \
--ebin \
--lib \
--priv \
--separator \
--src \
--rel"
elif [[ ${prev} == pkgs ]] ; then
:
elif [[ ${prev} == plugins ]] ; then

+ 12
- 0
priv/shell-completion/fish/rebar3.fish Näytä tiedosto

@ -44,6 +44,7 @@ end
## eunit Run EUnit Tests.
## help Display a list of tasks or help for a given task or subtask.
## new Create new project from templates.
## path Print paths to build dirs in current profile.
## pkgs List available packages.
## release Build release of project.
## relup Create relup of releases.
@ -118,6 +119,17 @@ complete -f -c 'rebar3' -n '__fish_rebar3_needs_command' -a new -d "Create new p
complete -f -c 'rebar3' -n '__fish_rebar3_using_command new' -s f -l force -d "Overwrite existing files"
complete -f -c 'rebar3' -n '__fish_rebar3_using_command new' -a help -d "Display all variables and arguments for each template"
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command' -a paths -d "Print paths to build dirs in current profile."
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command paths' -l app -d "Comma seperated list of applications to return paths for."
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command paths' -l base -d "Return the `base' path of the current profile."
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command paths' -l bin -d Return the `bin' path of the current profile."
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command paths' -l ebin -d "Return all `ebin' paths of the current profile's applications."
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command paths' -l lib -d "Return the `lib' path of the current profile."
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command paths' -l priv -d "Return the `priv' path of the current profile's applications."
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command paths' -s s -l separator -d "In case of multiple return paths, the separator character to use to join them."
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command paths' -l src -d "Return the `src' path of the current profile's applications."
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command paths' -l rel -d "Return the `rel' path of the current profile."
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command' -a pkgs -d "List available packages."
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command' -a release -d "Build release of project."
complete -f -c 'rebar3' -n '__fish_rebar3_needs_command' -a relup -d "Create relup of releases."

+ 11
- 0
priv/shell-completion/zsh/_rebar3 Näytä tiedosto

@ -108,6 +108,17 @@ _rebar3 () {
'(-f --force)'{-f,--force}'[ overwrite existing files]' \
&& ret=0
;;
(path)
_arguments \
'(--app)--app[Comma seperated list of applications to return paths for.]:apps' \
'(--base)--base[Return the `base' path of the current profile.]' \
'(--bin)--bin[Return the `bin' path of the current profile.]' \
'(--ebin)--ebin[Return all `ebin' paths of the current profile's applications.]' \
'(--lib)--lib[Return the `lib' path of the current profile.]' \
'(--priv)--priv[Return the `priv' path of the current profile's applications.]' \
'(-s --separator)--separator[In case of multiple return paths, the separator character to use to join them.]' \
&& ret=0
;;
(pkgs)
_message 'List available packages.' && ret=0
;;

+ 5
- 5
src/rebar_prv_path.erl Näytä tiedosto

@ -36,8 +36,8 @@ do(State) ->
{RawOpts, _} = rebar_state:command_parsed_args(State),
%% retrieve apps to filter by for other args
Apps = filter_apps(RawOpts, State),
%% remove apps and seperator opts from options
Paths = lists:filter(fun({app, _}) -> false; ({seperator, _}) -> false; (_) -> true end, RawOpts),
%% remove apps and separator opts from options
Paths = lists:filter(fun({app, _}) -> false; ({separator, _}) -> false; (_) -> true end, RawOpts),
%% if no paths requested in opts print the base_dir instead
P = case Paths of [] -> [{ebin, true}]; _ -> Paths end,
case paths(P, Apps, State, []) of
@ -91,7 +91,7 @@ src_dirs(Apps, State) ->
print_paths_if_exist(Paths, State) ->
{RawOpts, _} = rebar_state:command_parsed_args(State),
Sep = proplists:get_value(seperator, RawOpts, " "),
Sep = proplists:get_value(separator, RawOpts, " "),
RealPaths = lists:filter(fun(P) -> ec_file:is_dir(P) end, Paths),
io:format("~s", [string:join(RealPaths, Sep)]).
@ -112,7 +112,7 @@ eunit_opts(_State) ->
{ebin, undefined, "ebin", boolean, help(ebin)},
{lib, undefined, "lib", boolean, help(lib)},
{priv, undefined, "priv", boolean, help(priv)},
{seperator, $s, "seperator", string, help(seperator)},
{separator, $s, "separator", string, help(separator)},
{src, undefined, "src", boolean, help(src)},
{rel, undefined, "rel", boolean, help(rel)}].
@ -122,6 +122,6 @@ help(bin) -> "Return the `bin' path of the current profile.";
help(ebin) -> "Return all `ebin' paths of the current profile's applications.";
help(lib) -> "Return the `lib' path of the current profile.";
help(priv) -> "Return the `priv' path of the current profile's applications.";
help(seperator) -> "In case of multiple return paths, the seperator character to use to join them.";
help(separator) -> "In case of multiple return paths, the separator character to use to join them.";
help(src) -> "Return the `src' path of the current profile's applications.";
help(rel) -> "Return the `rel' path of the current profile.".

Ladataan…
Peruuta
Tallenna