@furrymink/cli 0.0.0-stage → 0.0.2
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/README.md +92 -2
- package/bin/app/create/gateway.sh +31 -0
- package/bin/app/create/includes.sh +6 -0
- package/bin/app/create/mobile.native.android.sh +3 -0
- package/bin/app/create/mobile.native.apple.sh +3 -0
- package/bin/app/create/mobile.native.sh +24 -0
- package/bin/app/create/mobile.sh +24 -0
- package/bin/app/create/mobile.wrapped.sh +58 -0
- package/bin/app/gateway.sh +14 -0
- package/bin/app/includes.sh +1 -0
- package/bin/cli/entry-point.sh +5 -0
- package/bin/cli/gateway.sh +24 -0
- package/bin/cli/includes.sh +9 -0
- package/bin/create/gateway.sh +17 -0
- package/bin/create/includes.sh +1 -0
- package/bin/furrymink +17 -0
- package/bin/git/commit.sh +18 -0
- package/bin/git/gateway.sh +19 -0
- package/bin/git/includes.sh +4 -0
- package/bin/git/push.sh +5 -0
- package/bin/git/rebase.sh +18 -0
- package/bin/modules/console/console.echo.sh +95 -0
- package/bin/modules/console/console.error.sh +14 -0
- package/bin/modules/console/console.header.sh +10 -0
- package/bin/modules/console/console.hint.sh +20 -0
- package/bin/modules/console/console.info.sh +10 -0
- package/bin/modules/console/console.keypair.sh +19 -0
- package/bin/modules/console/console.log.sh +8 -0
- package/bin/modules/console/console.prompt.sh +40 -0
- package/bin/modules/console/console.warn.sh +33 -0
- package/bin/modules/console/includes.sh +10 -0
- package/bin/modules/includes.sh +3 -0
- package/bin/modules/input/includes.sh +3 -0
- package/bin/modules/input/input.select.sh +82 -0
- package/bin/modules/input/input.text.sh +61 -0
- package/bin/npm/bump.sh +56 -0
- package/bin/npm/gateway.sh +22 -0
- package/bin/npm/includes.sh +5 -0
- package/bin/npm/login.sh +5 -0
- package/bin/npm/logout.sh +5 -0
- package/bin/npm/publish.sh +3 -0
- package/bin/plugin/create.sh +3 -0
- package/bin/plugin/gateway.sh +14 -0
- package/bin/plugin/includes.sh +3 -0
- package/package.json +22 -4
package/README.md
CHANGED
|
@@ -1,3 +1,93 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
|
8
|
+
|
|
9
|
+
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
|
10
|
+
|
|
11
|
+
## Add your files
|
|
12
|
+
|
|
13
|
+
* [Create](https://docs.gitlab.com/user/project/repository/web_editor/#create-a-file) or [upload](https://docs.gitlab.com/user/project/repository/web_editor/#upload-a-file) files
|
|
14
|
+
* [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
cd existing_repo
|
|
18
|
+
git remote add origin https://gitlab.com/furrymink/cli.git
|
|
19
|
+
git branch -M main
|
|
20
|
+
git push -uf origin main
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Integrate with your tools
|
|
24
|
+
|
|
25
|
+
* [Set up project integrations](https://gitlab.com/furrymink/cli/-/settings/integrations)
|
|
26
|
+
|
|
27
|
+
## Collaborate with your team
|
|
28
|
+
|
|
29
|
+
* [Invite team members and collaborators](https://docs.gitlab.com/user/project/members/)
|
|
30
|
+
* [Create a new merge request](https://docs.gitlab.com/user/project/merge_requests/creating_merge_requests/)
|
|
31
|
+
* [Automatically close issues from merge requests](https://docs.gitlab.com/user/project/issues/managing_issues/#closing-issues-automatically)
|
|
32
|
+
* [Enable merge request approvals](https://docs.gitlab.com/user/project/merge_requests/approvals/)
|
|
33
|
+
* [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
|
|
34
|
+
|
|
35
|
+
## Test and Deploy
|
|
36
|
+
|
|
37
|
+
Use the built-in continuous integration in GitLab.
|
|
38
|
+
|
|
39
|
+
* [Get started with GitLab CI/CD](https://docs.gitlab.com/ci/quick_start/)
|
|
40
|
+
* [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/user/application_security/sast/)
|
|
41
|
+
* [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/topics/autodevops/requirements/)
|
|
42
|
+
* [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/user/clusters/agent/)
|
|
43
|
+
* [Set up protected environments](https://docs.gitlab.com/ci/environments/protected_environments/)
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
# Editing this README
|
|
48
|
+
|
|
49
|
+
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
|
50
|
+
|
|
51
|
+
## Suggestions for a good README
|
|
52
|
+
|
|
53
|
+
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
|
54
|
+
|
|
55
|
+
## Name
|
|
56
|
+
Choose a self-explaining name for your project.
|
|
57
|
+
|
|
58
|
+
## Description
|
|
59
|
+
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
60
|
+
|
|
61
|
+
## Badges
|
|
62
|
+
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
|
63
|
+
|
|
64
|
+
## Visuals
|
|
65
|
+
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
|
72
|
+
|
|
73
|
+
## Support
|
|
74
|
+
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
|
75
|
+
|
|
76
|
+
## Roadmap
|
|
77
|
+
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
78
|
+
|
|
79
|
+
## Contributing
|
|
80
|
+
State if you are open to contributions and what your requirements are for accepting them.
|
|
81
|
+
|
|
82
|
+
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
|
83
|
+
|
|
84
|
+
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
|
85
|
+
|
|
86
|
+
## Authors and acknowledgment
|
|
87
|
+
Show your appreciation to those who have contributed to the project.
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
For open source projects, say how it is licensed.
|
|
91
|
+
|
|
92
|
+
## Project status
|
|
93
|
+
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
app.gateway(){
|
|
2
|
+
echo "app.create"
|
|
3
|
+
local ARGS=("$@")
|
|
4
|
+
|
|
5
|
+
local _DEVICE=$(
|
|
6
|
+
input.select "Select device" \
|
|
7
|
+
--prefill "1" \
|
|
8
|
+
--options "Mobile|Desktop|Web|Watch|TV"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
case $_DEVICE in
|
|
12
|
+
"Mobile")
|
|
13
|
+
app.create.mobile "${ARGS[@]}"
|
|
14
|
+
;;
|
|
15
|
+
"Desktop")
|
|
16
|
+
console.log "Not yet implemented"
|
|
17
|
+
;;
|
|
18
|
+
"Web")
|
|
19
|
+
console.log "Not yet implemented"
|
|
20
|
+
;;
|
|
21
|
+
"Watch")
|
|
22
|
+
console.log "Not yet implemented"
|
|
23
|
+
;;
|
|
24
|
+
"TV")
|
|
25
|
+
console.log "Not yet implemented"
|
|
26
|
+
;;
|
|
27
|
+
*)
|
|
28
|
+
console.error "Invalid choice"
|
|
29
|
+
;;
|
|
30
|
+
esac
|
|
31
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
include.scripts "app/create/mobile.sh"
|
|
2
|
+
include.scripts "app/create/mobile.wrapped.sh"
|
|
3
|
+
include.scripts "app/create/mobile.native.sh"
|
|
4
|
+
include.scripts "app/create/mobile.native.apple.sh"
|
|
5
|
+
include.scripts "app/create/mobile.native.android.sh"
|
|
6
|
+
include.scripts "app/create/gateway.sh"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
app.create.mobile.native(){
|
|
2
|
+
console.header "Create Native Mobile App"
|
|
3
|
+
|
|
4
|
+
local ARGS=("$@")
|
|
5
|
+
|
|
6
|
+
local _DEVICE=$(
|
|
7
|
+
input.select "OS" \
|
|
8
|
+
--prefill "1" \
|
|
9
|
+
--options "Apple|Android"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
case $_DEVICE in
|
|
13
|
+
"Apple")
|
|
14
|
+
app.create.mobile.native.apple "${ARGS[@]}"
|
|
15
|
+
;;
|
|
16
|
+
"Android")
|
|
17
|
+
app.create.mobile.wrapped.android "${ARGS[@]}"
|
|
18
|
+
;;
|
|
19
|
+
*)
|
|
20
|
+
console.error "Invalid choice"
|
|
21
|
+
;;
|
|
22
|
+
esac
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
app.create.mobile(){
|
|
2
|
+
console.header "Create Mobile App"
|
|
3
|
+
|
|
4
|
+
local ARGS=("$@")
|
|
5
|
+
|
|
6
|
+
local _DEVICE=$(
|
|
7
|
+
input.select "Type" \
|
|
8
|
+
--prefill "1" \
|
|
9
|
+
--options "Native|Native(Wrapped)"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
case $_DEVICE in
|
|
13
|
+
"Native")
|
|
14
|
+
app.create.mobile.native "${ARGS[@]}"
|
|
15
|
+
;;
|
|
16
|
+
"Native(Wrapped)")
|
|
17
|
+
app.create.mobile.wrapped "${ARGS[@]}"
|
|
18
|
+
;;
|
|
19
|
+
*)
|
|
20
|
+
console.error "Invalid choice"
|
|
21
|
+
;;
|
|
22
|
+
esac
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
__furrymink.install.ios(){
|
|
2
|
+
npm install @capacitor/ios
|
|
3
|
+
npx cap add ios
|
|
4
|
+
}
|
|
5
|
+
__furrymink.install.android(){
|
|
6
|
+
npm install @capacitor/android
|
|
7
|
+
npx cap add android
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
furrymink.create.mobile.wrapped(){
|
|
11
|
+
console.header "Create Wrapped Mobile App"
|
|
12
|
+
|
|
13
|
+
local ARGS=("$@")
|
|
14
|
+
local _BASE_REPO_URL="furrymink"
|
|
15
|
+
|
|
16
|
+
local _APP_NAME=$(get.app-name "my-app")
|
|
17
|
+
local _NORMALISED_APP_NAME=$(normalise.package-id $_APP_NAME)
|
|
18
|
+
local _GIT_BASE_URL="${_BASE_REPO_URL}/${_NORMALISED_APP_NAME}"
|
|
19
|
+
|
|
20
|
+
local _PACKAGE_ID=$(get.package-id $_BASE_REPO_URL $_APP_NAME)
|
|
21
|
+
local _HOMEPAGE_URL=$(get.home-page-url "$_GIT_BASE_URL")
|
|
22
|
+
local _REPO_URL=$(get.repo-url "$_GIT_BASE_URL")
|
|
23
|
+
local _README_URL=$(get.read-me-url "$_GIT_BASE_URL")
|
|
24
|
+
local _BUGS_URL=$(get.bugs-url "$_GIT_BASE_URL")
|
|
25
|
+
local _LICENSE_URL=$(get.license "$_GIT_BASE_URL")
|
|
26
|
+
local _AUTHOR_URL=$(get.author "$_GIT_BASE_URL")
|
|
27
|
+
local _DESCRIPTION=$(get.description "Give a short description of what $_APP_NAME does")
|
|
28
|
+
local _DEV_BOWSER_PORT=$(get.broswer-port "3000")
|
|
29
|
+
local _TYPE=$(get.type)
|
|
30
|
+
|
|
31
|
+
local _PLATFORM=""
|
|
32
|
+
|
|
33
|
+
npx cap init "${_APP_NAME}" "${PACKAGE_ID}" --web-dir "www/dist"
|
|
34
|
+
|
|
35
|
+
local _TARGET_PLATFORM=$(
|
|
36
|
+
input.select "Select OS" \
|
|
37
|
+
--prefill "1" \
|
|
38
|
+
--options "Android|iOS|Both"
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
case $_TARGET_PLATFORM in
|
|
42
|
+
"Android")
|
|
43
|
+
__furrymink.install.android
|
|
44
|
+
;;
|
|
45
|
+
"iOS")
|
|
46
|
+
__furrymink.install.ios
|
|
47
|
+
;;
|
|
48
|
+
"Both")
|
|
49
|
+
__furrymink.install.android
|
|
50
|
+
__furrymink.install.ios
|
|
51
|
+
;;
|
|
52
|
+
*)
|
|
53
|
+
console.error "Invalid choice" >&2
|
|
54
|
+
install-capacitor
|
|
55
|
+
;;
|
|
56
|
+
esac
|
|
57
|
+
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include.scripts "app/create/includes.sh"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
cli.gateway(){
|
|
2
|
+
local COMMAND="$1"
|
|
3
|
+
shift
|
|
4
|
+
|
|
5
|
+
local ARGS=("$@")
|
|
6
|
+
|
|
7
|
+
case $COMMAND in
|
|
8
|
+
git)
|
|
9
|
+
console.echo "GIT"
|
|
10
|
+
git.gateway "${ARGS[@]}";;
|
|
11
|
+
# include.scripts "git/entry.sh" "$@";;
|
|
12
|
+
npm)
|
|
13
|
+
console.echo "NPM"
|
|
14
|
+
npm.gateway "${ARGS[@]}";;
|
|
15
|
+
# include.scripts "npm/entry.sh" "$@";;
|
|
16
|
+
create)
|
|
17
|
+
create.gateway "${ARGS[@]}";;
|
|
18
|
+
# include.scripts "plugin/entry.sh" "$@";;
|
|
19
|
+
*)
|
|
20
|
+
console.error "Unknown command '${COMMAND}'";;
|
|
21
|
+
|
|
22
|
+
esac
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
create.gateway(){
|
|
2
|
+
local _TYPE="$1"
|
|
3
|
+
shift
|
|
4
|
+
|
|
5
|
+
local ARGS=("$@")
|
|
6
|
+
|
|
7
|
+
case $_TYPE in
|
|
8
|
+
"app")
|
|
9
|
+
ARGS=("create" "${ARGS[@]}")
|
|
10
|
+
app.gateway "${ARGS[@]}";;
|
|
11
|
+
"plugin")
|
|
12
|
+
ARGS=("create" "${ARGS[@]}")
|
|
13
|
+
furrymink.plugin.gateway "${ARGS[@]}";;
|
|
14
|
+
*)
|
|
15
|
+
console.error "Invalid create command";;
|
|
16
|
+
esac
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include.scripts "create/gateway.sh"
|
package/bin/furrymink
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#! /bin/bash
|
|
2
|
+
BIN_PATH="$(cd -- "$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")" && pwd)"
|
|
3
|
+
CLI_PATH="$(realpath "$BIN_PATH/..")"
|
|
4
|
+
MODULES_PATH="${BIN_PATH}/modules"
|
|
5
|
+
|
|
6
|
+
include.scripts(){
|
|
7
|
+
local SCRIPTS=("$@")
|
|
8
|
+
local PATH=""
|
|
9
|
+
|
|
10
|
+
for SCRIPT in "${SCRIPTS[@]}"; do
|
|
11
|
+
. "${BIN_PATH}/${SCRIPT}"
|
|
12
|
+
done
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
include.scripts "cli/includes.sh"
|
|
16
|
+
|
|
17
|
+
cli.entry-point "$@"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
furrymink.git.commit(){
|
|
2
|
+
console.header "furrymink.git.commit"
|
|
3
|
+
|
|
4
|
+
local _MESSAGE="New commit"
|
|
5
|
+
|
|
6
|
+
while [[ $# -gt 0 ]]; do
|
|
7
|
+
case $1 in
|
|
8
|
+
--message | -m )
|
|
9
|
+
_MESSAGE="$2"
|
|
10
|
+
shift 2;;
|
|
11
|
+
*)
|
|
12
|
+
console.error "Invalid commit command"; exit 1;;
|
|
13
|
+
esac
|
|
14
|
+
done
|
|
15
|
+
|
|
16
|
+
git add .
|
|
17
|
+
git commit -m "${_MESSAGE}"
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
furrymink.git.gateway(){
|
|
2
|
+
console.header "furrymink.git.gateway"
|
|
3
|
+
local COMMAND="$1"
|
|
4
|
+
shift
|
|
5
|
+
|
|
6
|
+
local ARGS=("$@")
|
|
7
|
+
|
|
8
|
+
case $COMMAND in
|
|
9
|
+
"commit" | "c" )
|
|
10
|
+
console.echo "GIT COMMIT"
|
|
11
|
+
furrymink.git.commit "${ARGS[@]}";;
|
|
12
|
+
#git.commit $@;;
|
|
13
|
+
"push")
|
|
14
|
+
console.echo "GIT PUSH";;
|
|
15
|
+
#git.push $@;;
|
|
16
|
+
*)
|
|
17
|
+
console.error "Invalid git command";;
|
|
18
|
+
esac
|
|
19
|
+
}
|
package/bin/git/push.sh
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
furrymink.git.rebase(){
|
|
2
|
+
console.header "furrymink.git.rebase"
|
|
3
|
+
|
|
4
|
+
local _BRANCH="main"
|
|
5
|
+
|
|
6
|
+
while [[ $# -gt 0 ]]; do
|
|
7
|
+
case $1 in
|
|
8
|
+
--branch | -b )
|
|
9
|
+
_BRANCH="$2"
|
|
10
|
+
shift 2;;
|
|
11
|
+
*)
|
|
12
|
+
console.error "Invalid rebase command"; exit 1;;
|
|
13
|
+
esac
|
|
14
|
+
done
|
|
15
|
+
|
|
16
|
+
git rebase -i --autostash "${_BRANCH}"
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
console.echo(){
|
|
4
|
+
local MESSAGE="$1"
|
|
5
|
+
shift
|
|
6
|
+
|
|
7
|
+
local RED=""
|
|
8
|
+
local GREEN=""
|
|
9
|
+
local BLUE=""
|
|
10
|
+
local FORE=$'\e[38;2;255;0;0m\e[48;2;100;0;0m'
|
|
11
|
+
local BACK=""
|
|
12
|
+
local PREFIX=""
|
|
13
|
+
local SUFFIX=$'\n'
|
|
14
|
+
local PADDING=""
|
|
15
|
+
local PADS=()
|
|
16
|
+
local RESET=$'\033[0m'
|
|
17
|
+
local STREAM="false"
|
|
18
|
+
|
|
19
|
+
while [[ $# -gt 0 ]]; do
|
|
20
|
+
case $1 in
|
|
21
|
+
--padding)
|
|
22
|
+
PADDING=$2
|
|
23
|
+
IFS=' ' read -r -a PADS <<< "$PADDING"
|
|
24
|
+
|
|
25
|
+
# Iterate over the resulting list
|
|
26
|
+
for PAD in "${PADS[@]}"; do
|
|
27
|
+
case $PAD in
|
|
28
|
+
"top")
|
|
29
|
+
PREFIX="$PREFIX"$'\n'
|
|
30
|
+
;;
|
|
31
|
+
"bottom")
|
|
32
|
+
SUFFIX="$SUFFIX"$'\n'
|
|
33
|
+
;;
|
|
34
|
+
"left")
|
|
35
|
+
PREFIX="$PREFIX"$'\t'
|
|
36
|
+
;;
|
|
37
|
+
"right")
|
|
38
|
+
SUFFIX="$SUFFIX"$'\t'
|
|
39
|
+
;;
|
|
40
|
+
*)
|
|
41
|
+
echo "ERROR"
|
|
42
|
+
;;
|
|
43
|
+
esac
|
|
44
|
+
|
|
45
|
+
done
|
|
46
|
+
shift 2 ;;
|
|
47
|
+
|
|
48
|
+
--foreground)
|
|
49
|
+
RED="$2";
|
|
50
|
+
GREEN="$3";
|
|
51
|
+
BLUE="$4";
|
|
52
|
+
|
|
53
|
+
FORE=$'\e[38;2;'$RED';'$GREEN';'$BLUE'm'
|
|
54
|
+
shift 4 ;;
|
|
55
|
+
|
|
56
|
+
--background)
|
|
57
|
+
RED="$2";
|
|
58
|
+
GREEN="$3";
|
|
59
|
+
BLUE="$4";
|
|
60
|
+
|
|
61
|
+
BACK=$'\e[48;2;'$RED';'$GREEN';'$BLUE'm'
|
|
62
|
+
shift 4 ;;
|
|
63
|
+
--no-wrap)
|
|
64
|
+
SUFFIX=""
|
|
65
|
+
shift 1 ;;
|
|
66
|
+
--to-stream)
|
|
67
|
+
STREAM="true"
|
|
68
|
+
shift 1 ;;
|
|
69
|
+
--bold)
|
|
70
|
+
PREFIX="$PREFIX"$'\e[1m'
|
|
71
|
+
shift 1 ;;
|
|
72
|
+
--italic)
|
|
73
|
+
PREFIX="$PREFIX"$'\e[3m'
|
|
74
|
+
shift 1 ;;
|
|
75
|
+
*) exit 1;;
|
|
76
|
+
esac
|
|
77
|
+
done
|
|
78
|
+
|
|
79
|
+
if [[ $STREAM == "true" ]]; then
|
|
80
|
+
printf '%s%s%s%s%s' \
|
|
81
|
+
"$PREFIX" \
|
|
82
|
+
"$FORE$BACK" \
|
|
83
|
+
"$MESSAGE" \
|
|
84
|
+
"$RESET" \
|
|
85
|
+
"$SUFFIX" >&2
|
|
86
|
+
else
|
|
87
|
+
printf '%s%s%s%s%s' \
|
|
88
|
+
"$PREFIX" \
|
|
89
|
+
"$FORE$BACK" \
|
|
90
|
+
"$MESSAGE" \
|
|
91
|
+
"$RESET" \
|
|
92
|
+
"$SUFFIX"
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
console.error(){
|
|
2
|
+
local MESSAGE="$1"
|
|
3
|
+
local PREFIX="Error: "
|
|
4
|
+
local SUFFIX=" !!"
|
|
5
|
+
|
|
6
|
+
local COMPOSED_MESSAGE="${PREFIX}${MESSAGE}${SUFFIX}"
|
|
7
|
+
local FOREGROUND="255 0 255"
|
|
8
|
+
local BACKGROUND="200 0 0";
|
|
9
|
+
|
|
10
|
+
console.echo "$COMPOSED_MESSAGE" \
|
|
11
|
+
--padding "top bottom" \
|
|
12
|
+
--foreground $FOREGROUND \
|
|
13
|
+
--background $BACKGROUND
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
console.hint(){
|
|
2
|
+
local MESSAGE="$1"
|
|
3
|
+
shift
|
|
4
|
+
|
|
5
|
+
local FOREGROUND="255 255 255"
|
|
6
|
+
local BACKGROUND="25 25 255";
|
|
7
|
+
local DELIMETER=""
|
|
8
|
+
|
|
9
|
+
while [[ $# -gt 0 ]]; do
|
|
10
|
+
case $1 in
|
|
11
|
+
--delimeter) DELIMETER="$2 "; shift 2 ;;
|
|
12
|
+
*) echo "Unknown: $1" >&2; return 1 ;;
|
|
13
|
+
esac
|
|
14
|
+
done
|
|
15
|
+
|
|
16
|
+
console.echo "$DELIMETER$MESSAGE" \
|
|
17
|
+
--foreground $FOREGROUND \
|
|
18
|
+
--background $BACKGROUND \
|
|
19
|
+
--to-stream
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
console.keypair(){
|
|
2
|
+
local KEY="$1"
|
|
3
|
+
local VALUE="$2"
|
|
4
|
+
|
|
5
|
+
local FOREGROUND_KEY="0 255 255"
|
|
6
|
+
local FOREGROUND_VALUE="255 255 0"
|
|
7
|
+
local FOREGROUND_EQUALS="0 0 255"
|
|
8
|
+
|
|
9
|
+
console.echo "$KEY" \
|
|
10
|
+
--foreground $FOREGROUND_KEY \
|
|
11
|
+
--no-wrap
|
|
12
|
+
|
|
13
|
+
console.echo " = " \
|
|
14
|
+
--foreground $FOREGROUND_EQUALS \
|
|
15
|
+
--no-wrap
|
|
16
|
+
|
|
17
|
+
console.echo "$VALUE" \
|
|
18
|
+
--foreground $FOREGROUND_VALUE
|
|
19
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
console.prompt(){
|
|
2
|
+
local PROMPT="$1"
|
|
3
|
+
shift
|
|
4
|
+
|
|
5
|
+
local DELIMETER=">"
|
|
6
|
+
local FOREGROUND="255 0 0"
|
|
7
|
+
local WARNING_FOREGROUND="255 255 255"
|
|
8
|
+
local WARNING_BACKGROUND="255 0 0"
|
|
9
|
+
local WARNING_MESSAGE=""
|
|
10
|
+
|
|
11
|
+
while [[ $# -gt 0 ]]; do
|
|
12
|
+
case $1 in
|
|
13
|
+
--delimiter) DELIMETER="$2"; shift 2 ;;
|
|
14
|
+
--prefill) PREFILL="$2"; shift 2 ;;
|
|
15
|
+
--warn) WARNING_MESSAGE="$2"; shift 2 ;;
|
|
16
|
+
*) echo "Unknown: $1" >&2; return 1 ;;
|
|
17
|
+
esac
|
|
18
|
+
done
|
|
19
|
+
|
|
20
|
+
local COMPOSED_PROMPT="${PROMPT}${DELIMETER}"
|
|
21
|
+
|
|
22
|
+
if [[ $WARNING_MESSAGE == "" ]]; then
|
|
23
|
+
console.echo "$COMPOSED_PROMPT" \
|
|
24
|
+
--foreground $FOREGROUND \
|
|
25
|
+
--no-wrap \
|
|
26
|
+
--bold \
|
|
27
|
+
--to-stream
|
|
28
|
+
else
|
|
29
|
+
console.echo "$COMPOSED_PROMPT" \
|
|
30
|
+
--foreground $FOREGROUND \
|
|
31
|
+
--to-stream
|
|
32
|
+
|
|
33
|
+
console.echo "$WARNING_MESSAGE" \
|
|
34
|
+
--foreground $WARNING_FOREGROUND \
|
|
35
|
+
--background $WARNING_BACKGROUND \
|
|
36
|
+
--no-wrap \
|
|
37
|
+
--bold \
|
|
38
|
+
--to-stream
|
|
39
|
+
fi
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
console.warn(){
|
|
2
|
+
local MESSAGE="$1"
|
|
3
|
+
shift
|
|
4
|
+
|
|
5
|
+
local FOREGROUND="0 0 255"
|
|
6
|
+
local BACKGROUND="200 200 0";
|
|
7
|
+
|
|
8
|
+
local INLINE="false"
|
|
9
|
+
|
|
10
|
+
while [[ $# -gt 0 ]]; do
|
|
11
|
+
case $1 in
|
|
12
|
+
--inline) INLINE="true"; shift 2 ;;
|
|
13
|
+
*) echo "Unknown: $1" >&2; return 1 ;;
|
|
14
|
+
esac
|
|
15
|
+
done
|
|
16
|
+
|
|
17
|
+
if [[ $INLINE == "true" ]]; then
|
|
18
|
+
console.echo "$MESSAGE" \
|
|
19
|
+
--foreground $FOREGROUND \
|
|
20
|
+
--background $BACKGROUND \
|
|
21
|
+
--bold \
|
|
22
|
+
--italic \
|
|
23
|
+
--to-stream
|
|
24
|
+
else
|
|
25
|
+
console.echo "$MESSAGE" \
|
|
26
|
+
--foreground $FOREGROUND \
|
|
27
|
+
--background $BACKGROUND \
|
|
28
|
+
--bold \
|
|
29
|
+
--italic
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
include.scripts \
|
|
2
|
+
"modules/console/console.error.sh" \
|
|
3
|
+
"modules/console/console.header.sh" \
|
|
4
|
+
"modules/console/console.info.sh" \
|
|
5
|
+
"modules/console/console.keypair.sh" \
|
|
6
|
+
"modules/console/console.prompt.sh" \
|
|
7
|
+
"modules/console/console.warn.sh" \
|
|
8
|
+
"modules/console/console.echo.sh" \
|
|
9
|
+
"modules/console/console.hint.sh" \
|
|
10
|
+
"modules/console/console.log.sh"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#! /bin/bash
|
|
2
|
+
|
|
3
|
+
input.select(){
|
|
4
|
+
local PROMPT="$1"
|
|
5
|
+
shift
|
|
6
|
+
|
|
7
|
+
local ORIGINAL_PROMPT="$PROMPT"
|
|
8
|
+
local DELIMETER=":"
|
|
9
|
+
local PREFILL=""
|
|
10
|
+
local ANSWER=""
|
|
11
|
+
local REQUIRED="false"
|
|
12
|
+
local HINTS=""
|
|
13
|
+
local WARNING_MESSAGE=""
|
|
14
|
+
local OPTIONS_STRING=""
|
|
15
|
+
local OPTIONS=""
|
|
16
|
+
local SELECTED_LABEL=""
|
|
17
|
+
local SELECTED_INDEX=""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
while [[ $# -gt 0 ]]; do
|
|
21
|
+
case $1 in
|
|
22
|
+
--warn) WARNING_MESSAGE="$2"; shift 2 ;;
|
|
23
|
+
--delimeter) DELIMETER="$2"; shift 2 ;;
|
|
24
|
+
--prefill) PREFILL="$2"; shift 2 ;;
|
|
25
|
+
--required)
|
|
26
|
+
REQUIRED="true";
|
|
27
|
+
PROMPT="${PROMPT} (required)"
|
|
28
|
+
shift 1 ;;
|
|
29
|
+
--hints) HINTS="$2"; shift 2 ;;
|
|
30
|
+
--options) OPTIONS_STRING="$2"; shift 2 ;;
|
|
31
|
+
*) echo "Unknown: $1" >&2; return 1 ;;
|
|
32
|
+
esac
|
|
33
|
+
done
|
|
34
|
+
|
|
35
|
+
if [[ $OPTIONS_STRING == "" ]]; then
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
IFS='|' read -r -a OPTIONS <<< "$OPTIONS_STRING"
|
|
40
|
+
|
|
41
|
+
console.prompt "$PROMPT" --delimiter "$DELIMETER" --warn "$WARNING_MESSAGE"
|
|
42
|
+
|
|
43
|
+
echo "" >&2
|
|
44
|
+
|
|
45
|
+
IFS='|' read -r -a HINTS_ARR <<< "$HINTS"
|
|
46
|
+
|
|
47
|
+
for HINT in "${HINTS_ARR[@]}"; do
|
|
48
|
+
console.hint "$HINT" --delimeter " -"
|
|
49
|
+
done
|
|
50
|
+
|
|
51
|
+
PS3="> "
|
|
52
|
+
|
|
53
|
+
select OPTION in "${OPTIONS[@]}"; do
|
|
54
|
+
SELECTED_LABEL=""
|
|
55
|
+
SELECTED_INDEX=""
|
|
56
|
+
|
|
57
|
+
for OPT in "${OPTIONS[@]}"; do
|
|
58
|
+
if [[ "$OPTION" == "$OPT" ]]; then
|
|
59
|
+
SELECTED_LABEL="${OPTION}"
|
|
60
|
+
SELECTED_INDEX="${REPLY}"
|
|
61
|
+
fi
|
|
62
|
+
done
|
|
63
|
+
|
|
64
|
+
if [[ $SELECTED_INDEX != "" ]]; then
|
|
65
|
+
break
|
|
66
|
+
else
|
|
67
|
+
if [[ $REQUIRED == "true" ]]; then
|
|
68
|
+
input.select "$ORIGINAL_PROMPT" \
|
|
69
|
+
--prefill "1" \
|
|
70
|
+
--options "Male|Female|Other" \
|
|
71
|
+
--required \
|
|
72
|
+
--hints "hint one|gont two|and a third" \
|
|
73
|
+
--warn "This is a required field"
|
|
74
|
+
fi
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
done
|
|
78
|
+
|
|
79
|
+
echo "${SELECTED_LABEL}"
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
input.text(){
|
|
2
|
+
local PROMPT="$1"
|
|
3
|
+
shift
|
|
4
|
+
|
|
5
|
+
local ORIGINAL_PROMPT="$PROMPT"
|
|
6
|
+
local DELIMETER_A=">"
|
|
7
|
+
local DELIMETER_B=""
|
|
8
|
+
local PREFILL=""
|
|
9
|
+
local ANSWER=""
|
|
10
|
+
local REQUIRED="false"
|
|
11
|
+
local HINTS=""
|
|
12
|
+
local WARNING_MESSAGE=""
|
|
13
|
+
|
|
14
|
+
while [[ $# -gt 0 ]]; do
|
|
15
|
+
case $1 in
|
|
16
|
+
--warn) WARNING_MESSAGE="$2"; shift 2 ;;
|
|
17
|
+
--delimeter) DELIMETER_A="$2"; shift 2 ;;
|
|
18
|
+
--prefill) PREFILL="$2"; shift 2 ;;
|
|
19
|
+
--required)
|
|
20
|
+
REQUIRED="true";
|
|
21
|
+
PROMPT="${PROMPT} (required)"
|
|
22
|
+
shift 1 ;;
|
|
23
|
+
--hints) HINTS="$2"; shift 2 ;;
|
|
24
|
+
*) echo "Unknown: $1" >&2; return 1 ;;
|
|
25
|
+
esac
|
|
26
|
+
done
|
|
27
|
+
|
|
28
|
+
if [[ $HINTS != "" ]]; then
|
|
29
|
+
DELIMETER_A=":"
|
|
30
|
+
DELIMETER_B=">"
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
if [[ $WARNING_MESSAGE == "" ]]; then
|
|
34
|
+
console.prompt "$PROMPT" --delimiter "$DELIMETER_A"
|
|
35
|
+
else
|
|
36
|
+
console.prompt "$PROMPT" --delimiter "$DELIMETER_A" --warn "$WARNING_MESSAGE"
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
if [[ $HINTS != "" ]]; then
|
|
40
|
+
echo "" >&2
|
|
41
|
+
IFS='|' read -r -a HINTS_ARR <<< "$HINTS"
|
|
42
|
+
|
|
43
|
+
for HINT in "${HINTS_ARR[@]}"; do
|
|
44
|
+
console.hint "$HINT" --delimeter " -"
|
|
45
|
+
done
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
read -e -p "$DELIMETER_B " -i "$PREFILL" ANSWER
|
|
49
|
+
|
|
50
|
+
if [[ $REQUIRED == "true" && $ANSWER == "" ]]; then
|
|
51
|
+
input.text \
|
|
52
|
+
"${ORIGINAL_PROMPT}" \
|
|
53
|
+
--hints "${HINTS}" \
|
|
54
|
+
--prefill "${PREFILL}"\
|
|
55
|
+
--delimeter "${DELIMETER_A}"\
|
|
56
|
+
--required \
|
|
57
|
+
--warn "Required field"
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
echo $ANSWER
|
|
61
|
+
}
|
package/bin/npm/bump.sh
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
furrymink.npm.bump(){
|
|
2
|
+
local _NEW_VERSION="interactive"
|
|
3
|
+
local _CURRENT_VERSION=""
|
|
4
|
+
local _VERSIONING=()
|
|
5
|
+
local _MAJOR=0
|
|
6
|
+
local _MINOR=0
|
|
7
|
+
local _PATCH=0
|
|
8
|
+
|
|
9
|
+
while [[ $# -gt 0 ]]; do
|
|
10
|
+
case $1 in
|
|
11
|
+
--version) _NEW_VERSION="$2"; shift 2 ;;
|
|
12
|
+
*)
|
|
13
|
+
console.error "Invalid argument [Code: $1]"
|
|
14
|
+
return 1 ;;
|
|
15
|
+
esac
|
|
16
|
+
done
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
if [[ $_NEW_VERSION == "interactive" ]]; then
|
|
20
|
+
_CURRENT_VERSION=$(npm pkg get version --workspaces=false | tr -d '"')
|
|
21
|
+
|
|
22
|
+
IFS='.' read -r -a _VERSIONING <<< "$_CURRENT_VERSION"
|
|
23
|
+
|
|
24
|
+
_MAJOR=${_VERSIONING[0]}
|
|
25
|
+
_MINOR=${_VERSIONING[1]}
|
|
26
|
+
_PATCH=${_VERSIONING[2]}
|
|
27
|
+
|
|
28
|
+
BUMP=$(
|
|
29
|
+
input.select "Bump level" \
|
|
30
|
+
--prefill "1" \
|
|
31
|
+
--options "Major|Minor|Patch")
|
|
32
|
+
|
|
33
|
+
echo "BUMP: ${BUMP}"
|
|
34
|
+
|
|
35
|
+
case $BUMP in
|
|
36
|
+
"Patch")
|
|
37
|
+
_PATCH=$((_PATCH + 1))
|
|
38
|
+
;;
|
|
39
|
+
"Minor")
|
|
40
|
+
_MINOR=$((_MINOR + 1))
|
|
41
|
+
;;
|
|
42
|
+
"Major")
|
|
43
|
+
_MAJOR=$((_MAJOR + 1))
|
|
44
|
+
;;
|
|
45
|
+
*)
|
|
46
|
+
console.error "Cannot bump"
|
|
47
|
+
;;
|
|
48
|
+
esac
|
|
49
|
+
|
|
50
|
+
_NEW_VERSION="${_MAJOR}.${_MINOR}.${_PATCH}"
|
|
51
|
+
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
npm version ${_NEW_VERSION}
|
|
55
|
+
|
|
56
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
furrymink.npm.gateway(){
|
|
2
|
+
console.header "furrymink.git.gateway"
|
|
3
|
+
local COMMAND="$1"
|
|
4
|
+
shift
|
|
5
|
+
|
|
6
|
+
local ARGS=("$@")
|
|
7
|
+
|
|
8
|
+
case $COMMAND in
|
|
9
|
+
"login" )
|
|
10
|
+
furrymink.npm.login "${ARGS[@]}";;
|
|
11
|
+
"logout" )
|
|
12
|
+
furrymink.npm.logout "${ARGS[@]}";;
|
|
13
|
+
"publish" )
|
|
14
|
+
furrymink.npm.publish "${ARGS[@]}";;
|
|
15
|
+
"bump" )
|
|
16
|
+
furrymink.npm.bump "${ARGS[@]}";;
|
|
17
|
+
"push")
|
|
18
|
+
furrymink.npm.push "${ARGS[@]}";;
|
|
19
|
+
*)
|
|
20
|
+
console.error "Invalid git command";;
|
|
21
|
+
esac
|
|
22
|
+
}
|
package/bin/npm/login.sh
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
furrymink.plugin.gateway(){
|
|
2
|
+
console.header "furrymink.plugin.gateway"
|
|
3
|
+
local COMMAND="$1"
|
|
4
|
+
shift
|
|
5
|
+
|
|
6
|
+
local ARGS=("$@")
|
|
7
|
+
|
|
8
|
+
case $COMMAND in
|
|
9
|
+
"create" | "c" )
|
|
10
|
+
furrymink.plugin.create "${ARGS[@]}";;
|
|
11
|
+
*)
|
|
12
|
+
console.error "Invalid git command";;
|
|
13
|
+
esac
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@furrymink/cli",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "To make it easy for you to get started with GitLab, here's a list of recommended next steps.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+ssh://git@gitlab.com/furrymink/cli.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [],
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "",
|
|
16
|
+
"type": "commonjs",
|
|
17
|
+
"bin": {
|
|
18
|
+
"furrymink": "bin/furrymink"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://gitlab.com/furrymink/cli/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://gitlab.com/furrymink/cli#readme"
|
|
24
|
+
}
|