workon 2.1.2 → 3.0.0
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 +19 -4
- package/bin/workon +1 -11
- package/dist/cli.js +2227 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +1216 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +280 -0
- package/dist/index.d.ts +280 -0
- package/dist/index.js +1173 -0
- package/dist/index.js.map +1 -0
- package/package.json +68 -21
- package/.claude/settings.local.json +0 -11
- package/.cursorindexingignore +0 -3
- package/.history/.gitignore_20250806202718 +0 -30
- package/.history/.gitignore_20250806231444 +0 -32
- package/.history/.gitignore_20250806231450 +0 -32
- package/.history/lib/tmux_20250806233103.js +0 -109
- package/.history/lib/tmux_20250806233219.js +0 -109
- package/.history/lib/tmux_20250806233223.js +0 -109
- package/.history/lib/tmux_20250806233230.js +0 -109
- package/.history/lib/tmux_20250806233231.js +0 -109
- package/.history/lib/tmux_20250807120751.js +0 -190
- package/.history/lib/tmux_20250807120757.js +0 -190
- package/.history/lib/tmux_20250807120802.js +0 -190
- package/.history/lib/tmux_20250807120808.js +0 -190
- package/.history/package_20250807114243.json +0 -43
- package/.history/package_20250807114257.json +0 -43
- package/.history/package_20250807114404.json +0 -43
- package/.history/package_20250807114409.json +0 -43
- package/.history/package_20250807114510.json +0 -43
- package/.history/package_20250807114637.json +0 -43
- package/.vscode/launch.json +0 -20
- package/.vscode/terminals.json +0 -11
- package/CHANGELOG.md +0 -103
- package/CLAUDE.md +0 -100
- package/cli/base.js +0 -16
- package/cli/config/index.js +0 -19
- package/cli/config/list.js +0 -26
- package/cli/config/set.js +0 -19
- package/cli/config/unset.js +0 -26
- package/cli/index.js +0 -184
- package/cli/interactive.js +0 -290
- package/cli/manage.js +0 -413
- package/cli/open.js +0 -414
- package/commands/base.js +0 -105
- package/commands/core/cwd/index.js +0 -86
- package/commands/core/ide/index.js +0 -84
- package/commands/core/web/index.js +0 -109
- package/commands/extensions/claude/index.js +0 -211
- package/commands/extensions/docker/index.js +0 -167
- package/commands/extensions/npm/index.js +0 -208
- package/commands/registry.js +0 -196
- package/demo-colon-syntax.js +0 -57
- package/docs/adr/001-command-centric-architecture.md +0 -304
- package/docs/adr/002-positional-command-arguments.md +0 -402
- package/docs/ideas.md +0 -93
- package/lib/config.js +0 -51
- package/lib/environment/base.js +0 -12
- package/lib/environment/index.js +0 -108
- package/lib/environment/project.js +0 -26
- package/lib/project.js +0 -68
- package/lib/tmux.js +0 -221
- package/lib/validation.js +0 -120
- package/test-architecture.js +0 -145
- package/test-colon-syntax.js +0 -85
- package/test-registry.js +0 -57
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "workon",
|
|
3
|
-
"version": "",
|
|
4
|
-
"description": "Work on something great!",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"release": "standard-version"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+ssh://git@github.com/israelroldan/workon.git"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"productivity"
|
|
15
|
-
],
|
|
16
|
-
"author": "Israel Roldan (me@isro.me)",
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"cz-conventional-changelog": "^2.0.0",
|
|
20
|
-
"standard-version": "^4.2.0"
|
|
21
|
-
},
|
|
22
|
-
"config": {
|
|
23
|
-
"commitizen": {
|
|
24
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"conf": "^1.1.2",
|
|
29
|
-
"deep-assign": "^2.0.0",
|
|
30
|
-
"flat": "^2.0.1",
|
|
31
|
-
"inquirer": "^3.1.1",
|
|
32
|
-
"loog": "^1.4.0",
|
|
33
|
-
"omelette": "^0.4.4",
|
|
34
|
-
"openurl2": "^1.0.1",
|
|
35
|
-
"phylo": "^1.0.0-beta.7",
|
|
36
|
-
"simple-git": "^1.73.0",
|
|
37
|
-
"switchit": "^1.0.7"
|
|
38
|
-
},
|
|
39
|
-
"bin": {
|
|
40
|
-
"workon": "bin/workon",
|
|
41
|
-
"wo": "bin/workon"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "workon",
|
|
3
|
-
"version": "",
|
|
4
|
-
"description": "Work on something great!",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"release": "standard-version"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+ssh://git@github.com/israelroldan/workon.git"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"productivity"
|
|
15
|
-
],
|
|
16
|
-
"author": "Israel Roldan (me@isro.me)",
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"cz-conventional-changelog": "^2.0.0",
|
|
20
|
-
"standard-version": "^4.2.0"
|
|
21
|
-
},
|
|
22
|
-
"config": {
|
|
23
|
-
"commitizen": {
|
|
24
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"conf": "^1.1.2",
|
|
29
|
-
"deep-assign": "^2.0.0",
|
|
30
|
-
"flat": "^2.0.1",
|
|
31
|
-
"inquirer": "^3.1.1",
|
|
32
|
-
"loog": "^1.4.0",
|
|
33
|
-
"omelette": "^0.4.4",
|
|
34
|
-
"openurl2": "^1.0.1",
|
|
35
|
-
"phylo": "^1.0.0-beta.7",
|
|
36
|
-
"simple-git": "^1.73.0",
|
|
37
|
-
"switchit": "^1.0.7"
|
|
38
|
-
},
|
|
39
|
-
"bin": {
|
|
40
|
-
"workon": "bin/workon",
|
|
41
|
-
"wo": "bin/workon"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "workon",
|
|
3
|
-
"version": "1.4.1",
|
|
4
|
-
"description": "Work on something great!",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"release": "standard-version"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+ssh://git@github.com/israelroldan/workon.git"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"productivity"
|
|
15
|
-
],
|
|
16
|
-
"author": "Israel Roldan (me@isro.me)",
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"cz-conventional-changelog": "^2.0.0",
|
|
20
|
-
"standard-version": "^4.2.0"
|
|
21
|
-
},
|
|
22
|
-
"config": {
|
|
23
|
-
"commitizen": {
|
|
24
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"conf": "^1.1.2",
|
|
29
|
-
"deep-assign": "^2.0.0",
|
|
30
|
-
"flat": "^2.0.1",
|
|
31
|
-
"inquirer": "^3.1.1",
|
|
32
|
-
"loog": "^1.4.0",
|
|
33
|
-
"omelette": "^0.4.4",
|
|
34
|
-
"openurl2": "^1.0.1",
|
|
35
|
-
"phylo": "^1.0.0-beta.7",
|
|
36
|
-
"simple-git": "^1.73.0",
|
|
37
|
-
"switchit": "^1.0.7"
|
|
38
|
-
},
|
|
39
|
-
"bin": {
|
|
40
|
-
"workon": "bin/workon",
|
|
41
|
-
"wo": "bin/workon"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "workon",
|
|
3
|
-
"version": "2.0.0-alpha.1",
|
|
4
|
-
"description": "Work on something great!",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"release": "standard-version"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+ssh://git@github.com/israelroldan/workon.git"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"productivity"
|
|
15
|
-
],
|
|
16
|
-
"author": "Israel Roldan (me@isro.me)",
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"cz-conventional-changelog": "^2.0.0",
|
|
20
|
-
"standard-version": "^9.5.0"
|
|
21
|
-
},
|
|
22
|
-
"config": {
|
|
23
|
-
"commitizen": {
|
|
24
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"conf": "^1.1.2",
|
|
29
|
-
"deep-assign": "^2.0.0",
|
|
30
|
-
"flat": "^2.0.1",
|
|
31
|
-
"inquirer": "^3.1.1",
|
|
32
|
-
"loog": "^1.4.0",
|
|
33
|
-
"omelette": "^0.4.4",
|
|
34
|
-
"openurl2": "^1.0.1",
|
|
35
|
-
"phylo": "^1.0.0-beta.7",
|
|
36
|
-
"simple-git": "^1.73.0",
|
|
37
|
-
"switchit": "^1.0.7"
|
|
38
|
-
},
|
|
39
|
-
"bin": {
|
|
40
|
-
"workon": "bin/workon",
|
|
41
|
-
"wo": "bin/workon"
|
|
42
|
-
}
|
|
43
|
-
}
|
package/.vscode/launch.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Use IntelliSense to learn about possible Node.js debug attributes.
|
|
3
|
-
// Hover to view descriptions of existing attributes.
|
|
4
|
-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
-
"version": "0.2.0",
|
|
6
|
-
"configurations": [
|
|
7
|
-
{
|
|
8
|
-
"type": "node",
|
|
9
|
-
"request": "attach",
|
|
10
|
-
"name": "Attach",
|
|
11
|
-
"port": 9229
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"type": "node",
|
|
15
|
-
"request": "launch",
|
|
16
|
-
"name": "Launch Program",
|
|
17
|
-
"program": "${workspaceRoot}/bin/workon"
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
package/.vscode/terminals.json
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
-
|
|
5
|
-
### [2.1.2](https://github.com/israelroldan/workon/compare/v2.1.1...v2.1.2) (2025-08-07)
|
|
6
|
-
|
|
7
|
-
### [2.1.1](https://github.com/israelroldan/workon/compare/v2.1.0...v2.1.1) (2025-08-07)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
### Bug Fixes
|
|
11
|
-
|
|
12
|
-
* Update tmux attach command to use -CC flag for compatibility with iTerm ([2d3d7c7](https://github.com/israelroldan/workon/commit/2d3d7c73fb164f1718908d276f91b8fba004f42d))
|
|
13
|
-
|
|
14
|
-
## [2.1.0](https://github.com/israelroldan/workon/compare/v2.0.0...v2.1.0) (2025-08-07)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
### Features
|
|
18
|
-
|
|
19
|
-
* Introduce colon syntax for selective command execution ([7b2193a](https://github.com/israelroldan/workon/commit/7b2193ace8cc014dfd71894e3e9f49e0fdea33b9))
|
|
20
|
-
|
|
21
|
-
## [2.0.0](https://github.com/israelroldan/workon/compare/v2.0.0-alpha.1...v2.0.0) (2025-08-07)
|
|
22
|
-
|
|
23
|
-
## [2.0.0-alpha.1](https://github.com/israelroldan/workon/compare/v1.4.1...v2.0.0-alpha.1) (2025-08-07)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
### Features
|
|
27
|
-
|
|
28
|
-
* Refactor to Command-Centric Architecture and enhance command management ([b7f8478](https://github.com/israelroldan/workon/commit/b7f84789e677222af34ae2018b7eb452dd054e34))
|
|
29
|
-
|
|
30
|
-
<a name="1.4.1"></a>
|
|
31
|
-
## [1.4.1](https://github.com/israelroldan/workon/compare/v1.4.0...v1.4.1) (2025-08-07)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<a name="1.4.0"></a>
|
|
36
|
-
# [1.4.0](https://github.com/israelroldan/workon/compare/v1.3.0...v1.4.0) (2025-08-06)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
### Features
|
|
40
|
-
|
|
41
|
-
* Integrate NPM command support and enhance terminal layouts ([f877ec4](https://github.com/israelroldan/workon/commit/f877ec4))
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<a name="1.3.0"></a>
|
|
46
|
-
# [1.3.0](https://github.com/israelroldan/workon/compare/v1.2.1...v1.3.0) (2025-08-06)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### Features
|
|
50
|
-
|
|
51
|
-
* Add split terminal support for 'claude' event (tmux based) ([c700afc](https://github.com/israelroldan/workon/commit/c700afc))
|
|
52
|
-
* Enhance 'claude' event configuration and validation ([12387e4](https://github.com/israelroldan/workon/commit/12387e4))
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<a name="1.2.1"></a>
|
|
57
|
-
## [1.2.1](https://github.com/israelroldan/workon/compare/v1.2.0...v1.2.1) (2025-08-06)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### Bug Fixes
|
|
61
|
-
|
|
62
|
-
* Adjust 'claude' command execution in shell mode ([c1bc5dc](https://github.com/israelroldan/workon/commit/c1bc5dc))
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<a name="1.2.0"></a>
|
|
67
|
-
# [1.2.0](https://github.com/israelroldan/workon/compare/v1.1.0...v1.2.0) (2025-08-06)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
### Features
|
|
71
|
-
|
|
72
|
-
* Introduce interactive project management feature ([3157e27](https://github.com/israelroldan/workon/commit/3157e27))
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<a name="1.1.0"></a>
|
|
77
|
-
# [1.1.0](https://github.com/israelroldan/workon/compare/v1.0.0...v1.1.0) (2025-08-06)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
### Bug Fixes
|
|
81
|
-
|
|
82
|
-
* Update package.json format for npm publish ([6c5e9e0](https://github.com/israelroldan/workon/commit/6c5e9e0))
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
### Features
|
|
86
|
-
|
|
87
|
-
* Enhance CLI with new 'claude' command support ([70b3f96](https://github.com/israelroldan/workon/commit/70b3f96))
|
|
88
|
-
* Improve shell integration for workon command ([f5b6ff0](https://github.com/israelroldan/workon/commit/f5b6ff0))
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<a name="1.0.0-alpha.1"></a>
|
|
93
|
-
# [1.0.0-alpha.1](https://code.palu.io/israel/workon/compare/v1.0.0-alpha.0...v1.0.0-alpha.1) (2017-06-26)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
<a name="1.0.0-alpha.0"></a>
|
|
98
|
-
# 1.0.0-alpha.0 (2017-06-26)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
### Features
|
|
102
|
-
|
|
103
|
-
* **Miscelaneous:** Initial commit 🎉 ✨ 😎 ([47ab926](https://code.palu.io/israel/workon/commits/47ab926))
|
package/CLAUDE.md
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
`workon` is a Node.js CLI tool for managing development projects and environments. It helps developers quickly switch between projects, configure IDEs, and manage git branches through an interactive interface.
|
|
8
|
-
|
|
9
|
-
## Development Commands
|
|
10
|
-
|
|
11
|
-
### Release Management
|
|
12
|
-
```bash
|
|
13
|
-
npm run release # Create a new release using standard-version
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Installation and Usage
|
|
17
|
-
```bash
|
|
18
|
-
npm install # Install dependencies
|
|
19
|
-
node bin/workon # Run the CLI tool directly
|
|
20
|
-
npm link # Install globally for development
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Architecture
|
|
24
|
-
|
|
25
|
-
### Core Components
|
|
26
|
-
|
|
27
|
-
**CLI Entry Point (`bin/workon`)**
|
|
28
|
-
- Main executable that initializes logging and runs the CLI
|
|
29
|
-
- Supports `--debug` flag for detailed logging
|
|
30
|
-
|
|
31
|
-
**Command System (`cli/`)**
|
|
32
|
-
- `cli/index.js`: Main CLI class extending switchit's container pattern
|
|
33
|
-
- `cli/interactive.js`: Interactive mode for project setup and management
|
|
34
|
-
- `cli/open.js`: Project opening and environment switching
|
|
35
|
-
- `cli/config/`: Configuration management commands
|
|
36
|
-
|
|
37
|
-
**Project Management (`lib/`)**
|
|
38
|
-
- `lib/project.js`: Project class with path, IDE, events, and branch properties
|
|
39
|
-
- `lib/environment/`: Environment recognition and project detection
|
|
40
|
-
- `lib/config.js`: Configuration storage using the `conf` package
|
|
41
|
-
|
|
42
|
-
### Key Architectural Patterns
|
|
43
|
-
|
|
44
|
-
**Environment Recognition**
|
|
45
|
-
- Automatically detects if current directory is a configured project
|
|
46
|
-
- Matches project paths against configuration
|
|
47
|
-
- Integrates with git to detect current branch
|
|
48
|
-
- Supports branch-specific project configurations (e.g., `project#branch`)
|
|
49
|
-
|
|
50
|
-
**Configuration System**
|
|
51
|
-
- Uses `conf` package for persistent storage
|
|
52
|
-
- Separates transient properties (`pkg`, `work`) from persistent config
|
|
53
|
-
- Stores project definitions and defaults
|
|
54
|
-
- Configuration lives in user's config directory
|
|
55
|
-
|
|
56
|
-
**Interactive Flow**
|
|
57
|
-
- Context-aware prompts based on current environment
|
|
58
|
-
- Different options when inside vs outside project directories
|
|
59
|
-
- Supports creating new projects, branches, and managing existing ones
|
|
60
|
-
|
|
61
|
-
**Event System**
|
|
62
|
-
- Projects can define events that trigger when opening:
|
|
63
|
-
- `cwd`: Change terminal directory to project path
|
|
64
|
-
- `ide`: Open project in configured IDE (VS Code, IntelliJ, Atom)
|
|
65
|
-
- `web`: Open project homepage in browser
|
|
66
|
-
- Events are processed when switching to a project
|
|
67
|
-
|
|
68
|
-
### Project Configuration Structure
|
|
69
|
-
|
|
70
|
-
Projects are stored with these properties:
|
|
71
|
-
- `name`: Project identifier
|
|
72
|
-
- `path`: Relative path from base directory
|
|
73
|
-
- `ide`: IDE command (`vscode`, `idea`, `atom`)
|
|
74
|
-
- `events`: Object defining which events to trigger
|
|
75
|
-
- `branch`: Git branch (for branch-specific configs)
|
|
76
|
-
|
|
77
|
-
### Dependencies
|
|
78
|
-
|
|
79
|
-
**Core Dependencies**
|
|
80
|
-
- `switchit`: CLI framework for commands and arguments
|
|
81
|
-
- `inquirer`: Interactive command-line prompts
|
|
82
|
-
- `conf`: Configuration storage
|
|
83
|
-
- `phylo`: File system utilities
|
|
84
|
-
- `simple-git`: Git integration
|
|
85
|
-
- `loog`: Logging system
|
|
86
|
-
|
|
87
|
-
**Utility Dependencies**
|
|
88
|
-
- `deep-assign`: Object merging
|
|
89
|
-
- `flat`: Object flattening
|
|
90
|
-
- `omelette`: Shell completion
|
|
91
|
-
- `openurl2`: Browser opening
|
|
92
|
-
|
|
93
|
-
## Development Notes
|
|
94
|
-
|
|
95
|
-
- The tool uses a class-based architecture with command inheritance
|
|
96
|
-
- Configuration is automatically managed and persisted
|
|
97
|
-
- Environment detection works by matching canonical paths
|
|
98
|
-
- Interactive mode provides different UX based on context
|
|
99
|
-
- Shell completion is supported via omelette
|
|
100
|
-
- Git integration detects current branch for branch-specific configs
|
package/cli/base.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const { Container, Command } = require('switchit');
|
|
2
|
-
|
|
3
|
-
module.exports.command = class basecommand extends Command {
|
|
4
|
-
attach (parent) {
|
|
5
|
-
super.attach(parent);
|
|
6
|
-
let root = this.root();
|
|
7
|
-
this.log = root.log;
|
|
8
|
-
this.config = root.config;
|
|
9
|
-
this.rootDir = root.rootDir;
|
|
10
|
-
return this;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
module.exports.container = class basecontainer extends Container {
|
|
15
|
-
|
|
16
|
-
};
|
package/cli/config/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const { container } = require('../base');
|
|
2
|
-
|
|
3
|
-
const list = require('./list');
|
|
4
|
-
const set = require('./set');
|
|
5
|
-
const unset = require('./unset');
|
|
6
|
-
|
|
7
|
-
class config extends container {}
|
|
8
|
-
|
|
9
|
-
config.define({
|
|
10
|
-
help: 'manage configuration parameters',
|
|
11
|
-
commands: {
|
|
12
|
-
'': 'list',
|
|
13
|
-
list,
|
|
14
|
-
set,
|
|
15
|
-
unset
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
module.exports = config;
|
package/cli/config/list.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const { command } = require('../base');
|
|
2
|
-
const flatten = require('flat');
|
|
3
|
-
|
|
4
|
-
class list extends command {
|
|
5
|
-
execute (params) {
|
|
6
|
-
let me = this;
|
|
7
|
-
|
|
8
|
-
let store = me.config._store;
|
|
9
|
-
me.log.info(`Config file is: ${store.path}`);
|
|
10
|
-
me.log.info();
|
|
11
|
-
for (let [key, value] of store) {
|
|
12
|
-
let obj = {};
|
|
13
|
-
obj[key] = value;
|
|
14
|
-
obj = flatten(obj);
|
|
15
|
-
for (let name in obj) {
|
|
16
|
-
me.log.info(`${name}: ${JSON.stringify(obj[name])}`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
list.define({
|
|
23
|
-
help: 'List configuration parameters'
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
module.exports = list;
|
package/cli/config/set.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const { command } = require('../base');
|
|
2
|
-
|
|
3
|
-
class set extends command {
|
|
4
|
-
execute (params) {
|
|
5
|
-
let me = this;
|
|
6
|
-
me.config.set(params.key, params.value);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
set.define({
|
|
11
|
-
help: {
|
|
12
|
-
'': 'Set a configuration parameter',
|
|
13
|
-
key: 'The configuration parameter to set',
|
|
14
|
-
value: 'The value to set'
|
|
15
|
-
},
|
|
16
|
-
parameters: '{key} {value}'
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
module.exports = set;
|
package/cli/config/unset.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const { command } = require('../base');
|
|
2
|
-
|
|
3
|
-
class unset extends command {
|
|
4
|
-
execute (params) {
|
|
5
|
-
let me = this;
|
|
6
|
-
if (!params.silent && !me.config.has(params.key)) {
|
|
7
|
-
throw new Error(`Unknown config ${params.key}`);
|
|
8
|
-
}
|
|
9
|
-
me.config.delete(params.key);
|
|
10
|
-
if (!params.silent) {
|
|
11
|
-
me.log.info(`Entry ${params.key} was removed from the configuration`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
unset.define({
|
|
17
|
-
help: {
|
|
18
|
-
'': 'Remove a configuration parameter',
|
|
19
|
-
silent: 'Suppress console output',
|
|
20
|
-
key: 'The configuration parameter to remove'
|
|
21
|
-
},
|
|
22
|
-
switches: '[silent:boolean=false]',
|
|
23
|
-
parameters: '{key}'
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
module.exports = unset;
|