@furry-boilerplates/command-line-interface 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/__install.sh CHANGED
@@ -1,39 +1,40 @@
1
1
  CLI_INSTALLER.__install(){
2
- local INIT_NPM="false"
3
- local SCOPE=""
4
- local NAME=""
5
-
6
- while [[ $# -gt 0 ]]; do
7
- case $1 in
8
- --scope) SCOPE="$2"; shift 2 ;;
9
- --name) NAME="$2"; shift 2 ;;
10
- --init-npm) INIT_NPM="true"; shift 1 ;;
11
- *) echo "Unknown: >$1<" >&2; return 1 ;;
12
- esac
13
- done
14
-
15
- if [[ $INIT_NPM == "true" ]]; then
2
+ local _INIT_NPM=$(
3
+ input.select "Initialise NPM package" \
4
+ --prefill "1" \
5
+ --options "yes|no"
6
+ )
7
+
8
+ if [[ $_INIT_NPM == "yes" ]]; then
16
9
  npm init -y
17
10
  npm install
18
11
  fi
19
12
 
20
- if [[ $NAME == "" ]]; then
21
- NAME=$(npm pkg get name | sed 's/"//g')
22
- fi
13
+ local _DEFAULT_NAME=$(npm pkg get name | sed 's/"//g')
23
14
 
24
- if [[ $SCOPE == "" ]]; then
25
- SCOPE="$NAME"
26
- fi
15
+ local _CLI_NAME=$(
16
+ input.text "Cli name" \
17
+ --prefill "$_DEFAULT_NAME" \
18
+ --required \
19
+ --no-spaces
20
+ )
21
+
22
+ local _SCOPE=$(
23
+ input.text "Cli scope" \
24
+ --prefill "$_CLI_NAME" \
25
+ --required \
26
+ --no-spaces
27
+ )
27
28
 
28
29
  echo "Installing CLI..."
29
30
 
30
31
  cp -rf "$__CLI_INSTALLER_CLI_PATH/dist/bin/." "$__CLI_INSTALLER_INSTALL_DIR/bin"
31
- mv "$__CLI_INSTALLER_INSTALL_DIR/bin/PACKAGENAME" "$__CLI_INSTALLER_INSTALL_DIR/bin/$NAME"
32
+ mv "$__CLI_INSTALLER_INSTALL_DIR/bin/PACKAGENAME" "$__CLI_INSTALLER_INSTALL_DIR/bin/$_CLI_NAME"
32
33
 
33
- find "$__CLI_INSTALLER_INSTALL_DIR/bin" -type f -exec sed -i "s/SCOPE/$SCOPE/" {} +
34
+ find "$__CLI_INSTALLER_INSTALL_DIR/bin" -type f -exec sed -i "s/SCOPE/$_SCOPE/" {} +
34
35
 
35
- npm pkg set "bin.$NAME=bin/$NAME"
36
+ npm pkg set "bin.$_CLI_NAME=bin/$_CLI_NAME"
36
37
 
37
38
  mkdir -p "$__CLI_INSTALLER_INSTALL_DIR/node_modules/.bin"
38
- ln -s "$__CLI_INSTALLER_INSTALL_DIR/bin/$NAME" "$__CLI_INSTALLER_INSTALL_DIR/node_modules/.bin/$NAME"
39
+ ln -s "$__CLI_INSTALLER_INSTALL_DIR/bin/$_CLI_NAME" "$__CLI_INSTALLER_INSTALL_DIR/node_modules/.bin/$_CLI_NAME"
39
40
  }
@@ -4,6 +4,9 @@ __SCOPE_MODULES_PATH="${__SCOPE_BIN_PATH}/modules"
4
4
  __SCOPE_INSTALL_DIR="$PWD"
5
5
  __SCOPE_PACKAGE_PATH="$(realpath "$__SCOPE_BIN_PATH/..")"
6
6
 
7
+ npm install @furrymink/cli@latest
8
+ source "${__SCOPE_INSTALL_DIR}/node_modules/@furrymink/cli/bin/includes.sh"
9
+
7
10
  SCOPE.include.scripts(){
8
11
  local BASE="${__SCOPE_BIN_PATH}"
9
12
  local SCRIPTS=()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@furry-boilerplates/command-line-interface",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "To make it easy for you to get started with GitLab, here's a list of recommended next steps.",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -20,6 +20,6 @@
20
20
  "dist/"
21
21
  ],
22
22
  "bin": {
23
- "cli-installer": "bin/entry"
23
+ "furrymink": "bin/entry"
24
24
  }
25
25
  }