Skip to content

Instantly share code, notes, and snippets.

@neilotoole
Created March 17, 2016 17:49
Show Gist options
  • Save neilotoole/b80d9a98253daaa86e9b to your computer and use it in GitHub Desktop.
Save neilotoole/b80d9a98253daaa86e9b to your computer and use it in GitHub Desktop.
Gist fo ringy
diff --git a/doc/hce-tool.swim b/doc/hce-tool.swim
index fb2ba79..acc4130 100644
--- a/doc/hce-tool.swim
+++ b/doc/hce-tool.swim
@@ -48,6 +48,9 @@ These are the hce-tool subcommands:
Self upgrade the hce-tool command.
+- `install-hce-cli`
+ Install the HCE CLI tool.
+
- `install-git-hub`
Install and configure the `git hub` command. This command is used by other
`hce-tool` commands and is quite useful on its own.
diff --git a/lib/hce-tool-help-functions.bash b/lib/hce-tool-help-functions.bash
index def4130..1218434 100644
--- a/lib/hce-tool-help-functions.bash
+++ b/lib/hce-tool-help-functions.bash
@@ -11,6 +11,7 @@ config config
get get <hce repo name>...|--all
help help
install-git-hub install-git-hub
+install-hce-cli install-hce-cli
queue queue [<fork>]
up up
upgrade upgrade
@@ -71,6 +72,15 @@ help:install-git-hub() {
...
}
+help:install-hce-cli() {
+ cat <<'...'
+
+ Usage: hce-tool install-hce-cli
+
+ Install the HCE CLI tool.
+...
+}
+
help:queue() {
cat <<'...'
diff --git a/lib/hce-tool-install-hce-cli b/lib/hce-tool-install-hce-cli
new file mode 100644
index 0000000..481371d
--- /dev/null
+++ b/lib/hce-tool-install-hce-cli
@@ -0,0 +1,27 @@
+#! bash
+
+command:install-hce-cli() {
+ path=$(config:read source-root-path)
+ if [[ ! -d "$path/hce-cli" ]]; then
+ (
+ cd $path
+ git clone https://github.com/hpcloud/hce-cli --recursive
+ )
+ fi
+
+ (
+ set -x
+ cd "$path/hce-cli"
+ ./build.sh
+ )
+
+ local bin="$path/hce-cli/bin/hce" sudo=
+ [[ -w /usr/local/bin ]] || sudo=sudo
+ (
+ set -x
+ $sudo ln -s "$bin" /usr/local/bin/hce
+ )
+
+ say "
+'hce-cli' Installed!"
+}
diff --git a/man/man1/hce-tool.1 b/man/man1/hce-tool.1
index a5f2083..dba9162 100644
--- a/man/man1/hce-tool.1
+++ b/man/man1/hce-tool.1
@@ -128,6 +128,10 @@ Show the outstanding pull requests for \s-1HCE\s0 repos. Defaults to \f(CW\*(C`h
.el .IP "\f(CWupgrade\fR" 4
.IX Item "upgrade"
Self upgrade the hce-tool command.
+.ie n .IP """install\-hce\-cli""" 4
+.el .IP "\f(CWinstall\-hce\-cli\fR" 4
+.IX Item "install-hce-cli"
+Install the \s-1HCE CLI\s0 tool.
.ie n .IP """install\-git\-hub""" 4
.el .IP "\f(CWinstall\-git\-hub\fR" 4
.IX Item "install-git-hub"
diff --git a/share/completion.bash b/share/completion.bash
index f859307..2e96cee 100644
--- a/share/completion.bash
+++ b/share/completion.bash
@@ -4,7 +4,7 @@
_hce-tool() {
local _opts=""
- local subcommands="check config get help install-git-hub queue up upgrade version"
+ local subcommands="check config get help install-git-hub install-hce-cli queue up upgrade version"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment