@microsoft/inshellisense 0.0.1-rc.21 → 0.0.1-rc.23
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/package.json +11 -78
- package/CODE_OF_CONDUCT.md +0 -9
- package/LICENSE +0 -21
- package/README.md +0 -132
- package/SECURITY.md +0 -41
- package/SUPPORT.md +0 -13
- package/build/commands/complete.js +0 -16
- package/build/commands/doctor.js +0 -11
- package/build/commands/init.js +0 -24
- package/build/commands/root.js +0 -37
- package/build/commands/specs/list.js +0 -26
- package/build/commands/specs/root.js +0 -8
- package/build/commands/uninstall.js +0 -11
- package/build/index.js +0 -35
- package/build/isterm/commandManager.js +0 -184
- package/build/isterm/index.js +0 -4
- package/build/isterm/pty.js +0 -361
- package/build/runtime/alias.js +0 -66
- package/build/runtime/generator.js +0 -55
- package/build/runtime/model.js +0 -3
- package/build/runtime/parser.js +0 -133
- package/build/runtime/runtime.js +0 -282
- package/build/runtime/spec.js +0 -36
- package/build/runtime/suggestion.js +0 -232
- package/build/runtime/template.js +0 -50
- package/build/runtime/utils.js +0 -121
- package/build/ui/suggestionManager.js +0 -162
- package/build/ui/ui-doctor.js +0 -69
- package/build/ui/ui-root.js +0 -141
- package/build/ui/ui-uninstall.js +0 -9
- package/build/ui/utils.js +0 -57
- package/build/utils/ansi.js +0 -37
- package/build/utils/config.js +0 -99
- package/build/utils/log.js +0 -39
- package/build/utils/shell.js +0 -318
- package/build/utils/version.js +0 -13
- package/scripts/postinstall.js +0 -9
- package/shell/bash-preexec.sh +0 -380
- package/shell/shellIntegration-env.zsh +0 -12
- package/shell/shellIntegration-login.zsh +0 -9
- package/shell/shellIntegration-profile.zsh +0 -9
- package/shell/shellIntegration-rc.zsh +0 -66
- package/shell/shellIntegration.bash +0 -114
- package/shell/shellIntegration.fish +0 -27
- package/shell/shellIntegration.nu +0 -29
- package/shell/shellIntegration.ps1 +0 -26
- package/shell/shellIntegration.xsh +0 -31
- package/todo.md +0 -17
package/package.json
CHANGED
|
@@ -1,34 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/inshellisense",
|
|
3
|
-
"version": "0.0.1-rc.
|
|
3
|
+
"version": "0.0.1-rc.23",
|
|
4
4
|
"description": "IDE style command line auto complete",
|
|
5
|
-
"
|
|
6
|
-
"engines": {
|
|
7
|
-
"node": ">=18.0 <23.0.0"
|
|
8
|
-
},
|
|
9
|
-
"bin": {
|
|
10
|
-
"inshellisense": "./build/index.js",
|
|
11
|
-
"is": "./build/index.js"
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"build/**",
|
|
15
|
-
"shell/**",
|
|
16
|
-
"scripts/**",
|
|
17
|
-
"*.md",
|
|
18
|
-
"LICENSE"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsc",
|
|
22
|
-
"dev": "node --import=tsx src/index.ts -V",
|
|
23
|
-
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
24
|
-
"test:e2e": "tui-test",
|
|
25
|
-
"lint": "eslint src/ --ext .ts,.tsx && prettier src/ --check",
|
|
26
|
-
"lint:fix": "eslint src/ --ext .ts,.tsx --fix && prettier src/ --write",
|
|
27
|
-
"debug": "node --inspect --import=tsx src/index.ts -V",
|
|
28
|
-
"reinstall": "rm -rf node_modules && npm install",
|
|
29
|
-
"pre-commit": "lint-staged",
|
|
30
|
-
"postinstall": "node ./scripts/postinstall.js"
|
|
31
|
-
},
|
|
5
|
+
"license": "MIT",
|
|
32
6
|
"repository": {
|
|
33
7
|
"type": "git",
|
|
34
8
|
"url": "git+https://github.com/microsoft/inshellisense.git"
|
|
@@ -36,57 +10,16 @@
|
|
|
36
10
|
"author": {
|
|
37
11
|
"name": "Microsoft Corporation"
|
|
38
12
|
},
|
|
39
|
-
"license": "MIT",
|
|
40
13
|
"bugs": {
|
|
41
14
|
"url": "https://github.com/microsoft/inshellisense/issues"
|
|
42
15
|
},
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"ansi-styles": "^6.2.1",
|
|
52
|
-
"chalk": "^5.3.0",
|
|
53
|
-
"color-convert": "^2.0.1",
|
|
54
|
-
"commander": "^11.0.0",
|
|
55
|
-
"find-process": "^1.4.7",
|
|
56
|
-
"strip-ansi": "^7.1.0",
|
|
57
|
-
"toml": "^3.0.0",
|
|
58
|
-
"wcwidth": "^1.0.1",
|
|
59
|
-
"which": "^4.0.0",
|
|
60
|
-
"wrap-ansi": "^8.1.0"
|
|
61
|
-
},
|
|
62
|
-
"devDependencies": {
|
|
63
|
-
"@microsoft/tui-test": "^0.0.1-rc.3",
|
|
64
|
-
"@tsconfig/node18": "^18.2.2",
|
|
65
|
-
"@types/color-convert": "^2.0.3",
|
|
66
|
-
"@types/jest": "^29.5.5",
|
|
67
|
-
"@types/react": "^18.2.24",
|
|
68
|
-
"@types/wcwidth": "^1.0.2",
|
|
69
|
-
"@types/which": "^3.0.3",
|
|
70
|
-
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
|
71
|
-
"@typescript-eslint/parser": "^6.7.4",
|
|
72
|
-
"@withfig/autocomplete-types": "^1.28.0",
|
|
73
|
-
"@xterm/xterm": "^5.5.0",
|
|
74
|
-
"eslint": "^8.51.0",
|
|
75
|
-
"eslint-config-prettier": "^9.0.0",
|
|
76
|
-
"eslint-plugin-header": "^3.1.1",
|
|
77
|
-
"eslint-plugin-react": "^7.33.2",
|
|
78
|
-
"husky": "^9.0.11",
|
|
79
|
-
"jest": "^29.7.0",
|
|
80
|
-
"lint-staged": "^15.2.2",
|
|
81
|
-
"prettier": "3.0.3",
|
|
82
|
-
"ts-jest": "^29.1.1",
|
|
83
|
-
"tsx": "^4.19.1",
|
|
84
|
-
"typescript": "^5.2.2"
|
|
85
|
-
},
|
|
86
|
-
"lint-staged": {
|
|
87
|
-
"{,src/**/}*.{ts,tsx}": [
|
|
88
|
-
"eslint --fix",
|
|
89
|
-
"prettier --write"
|
|
90
|
-
]
|
|
16
|
+
"files": [],
|
|
17
|
+
"optionalDependencies": {
|
|
18
|
+
"@microsoft/inshellisense-darwin-x64": "0.0.1-rc.23",
|
|
19
|
+
"@microsoft/inshellisense-darwin-arm64": "0.0.1-rc.23",
|
|
20
|
+
"@microsoft/inshellisense-linux-x64": "0.0.1-rc.23",
|
|
21
|
+
"@microsoft/inshellisense-linux-arm64": "0.0.1-rc.23",
|
|
22
|
+
"@microsoft/inshellisense-win32-x64": "0.0.1-rc.23",
|
|
23
|
+
"@microsoft/inshellisense-win32-arm64": "0.0.1-rc.23"
|
|
91
24
|
}
|
|
92
|
-
}
|
|
25
|
+
}
|
package/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# Microsoft Open Source Code of Conduct
|
|
2
|
-
|
|
3
|
-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
4
|
-
|
|
5
|
-
Resources:
|
|
6
|
-
|
|
7
|
-
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
|
|
8
|
-
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
|
9
|
-
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE
|
package/README.md
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
# inshellisense
|
|
2
|
-
|
|
3
|
-
`inshellisense` provides IDE style autocomplete for shells. It's a terminal native runtime for [autocomplete](https://github.com/withfig/autocomplete) which has support for 600+ command line tools. `inshellisense` supports Windows, Linux, & macOS.
|
|
4
|
-
|
|
5
|
-
<p align="center"><img alt="demo of inshellisense working" src="/docs/demo.gif"/></p>
|
|
6
|
-
|
|
7
|
-
## Getting Started
|
|
8
|
-
|
|
9
|
-
### Requirements
|
|
10
|
-
|
|
11
|
-
- Node.js 22.X, 20.X, 18.X
|
|
12
|
-
|
|
13
|
-
### Installation
|
|
14
|
-
|
|
15
|
-
```shell
|
|
16
|
-
npm install -g @microsoft/inshellisense
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### Quickstart
|
|
20
|
-
|
|
21
|
-
After completing the installation, run `is doctor` to verify your installation was successful. You can run `is` to start the autocomplete session for your desired shell. Additionally, inshellisense is also aliased under `inshellisense` after installation.
|
|
22
|
-
|
|
23
|
-
### Shell Plugin
|
|
24
|
-
|
|
25
|
-
If you'd like to automatically start inshellisense when you open your shell, run the respective command for your shell. After running the command, inshellisense will automatically open when you start any new shell session:
|
|
26
|
-
|
|
27
|
-
```shell
|
|
28
|
-
# bash
|
|
29
|
-
is init bash >> ~/.bashrc
|
|
30
|
-
|
|
31
|
-
# zsh
|
|
32
|
-
is init zsh >> ~/.zshrc
|
|
33
|
-
|
|
34
|
-
# fish
|
|
35
|
-
is init fish >> ~/.config/fish/config.fish
|
|
36
|
-
|
|
37
|
-
# pwsh
|
|
38
|
-
is init pwsh | Add-Content $profile
|
|
39
|
-
|
|
40
|
-
# powershell
|
|
41
|
-
is init powershell | Add-Content $profile
|
|
42
|
-
|
|
43
|
-
# xonsh
|
|
44
|
-
is init xonsh >> ~/.xonshrc
|
|
45
|
-
|
|
46
|
-
# nushell
|
|
47
|
-
is init nu | save $nu.env-path --append
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
> [!NOTE]
|
|
51
|
-
> When updating your shell configuration in the future, make sure the inshellisense plugin is the last command in the file. Including commands after it may break the configuration (ex. initializing your shell plugin manager after the inshellisense plugin)
|
|
52
|
-
|
|
53
|
-
### Usage
|
|
54
|
-
|
|
55
|
-
| Action | Command | Description |
|
|
56
|
-
| ------------------------------------- | ------- | ------------------------------------------------ |
|
|
57
|
-
| Start | `is` | Start inshellisense session on the current shell |
|
|
58
|
-
| Stop | `exit` | Stop inshellisense session on the current shell |
|
|
59
|
-
| Check If Inside Inshellisense Session | `is -c` | Check if shell inside inshellisense session |
|
|
60
|
-
|
|
61
|
-
#### Keybindings
|
|
62
|
-
|
|
63
|
-
All other keys are passed through to the shell. The keybindings below are only captured when the inshellisense suggestions are visible, otherwise they are passed through to the shell as well. These can be customized in the [config](#configuration).
|
|
64
|
-
|
|
65
|
-
| Action | Keybinding |
|
|
66
|
-
| ------------------------- | -------------- |
|
|
67
|
-
| Accept Current Suggestion | <kbd>tab</kbd> |
|
|
68
|
-
| View Next Suggestion | <kbd>↓</kbd> |
|
|
69
|
-
| View Previous Suggestion | <kbd>↑</kbd> |
|
|
70
|
-
| Dismiss Suggestions | <kbd>esc</kbd> |
|
|
71
|
-
|
|
72
|
-
## Integrations
|
|
73
|
-
|
|
74
|
-
inshellisense supports the following shells:
|
|
75
|
-
|
|
76
|
-
- [bash](https://www.gnu.org/software/bash/)
|
|
77
|
-
- [zsh](https://www.zsh.org/)
|
|
78
|
-
- [fish](https://github.com/fish-shell/fish-shell)
|
|
79
|
-
- [pwsh](https://github.com/PowerShell/PowerShell)
|
|
80
|
-
- [powershell](https://learn.microsoft.com/en-us/powershell/scripting/windows-powershell/starting-windows-powershell) (Windows Powershell)
|
|
81
|
-
- [cmd](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cmd) _(experimental)_
|
|
82
|
-
- [xonsh](https://xon.sh/)
|
|
83
|
-
- [nushell](https://www.nushell.sh/)
|
|
84
|
-
|
|
85
|
-
## Configuration
|
|
86
|
-
|
|
87
|
-
All configuration is done through a [toml](https://toml.io/) file. You can create this file at `~/.inshellisenserc` or, for XDG compliance, at `~/.config/inshellisense/rc.toml`. The [JSON schema](https://json-schema.org/) for the configuration file can be found [here](https://github.com/microsoft/inshellisense/blob/main/src/utils/config.ts).
|
|
88
|
-
|
|
89
|
-
### Keybindings
|
|
90
|
-
|
|
91
|
-
You can customize the keybindings for inshellisense by adding a `bindings` section to your config file. The following is the default configuration for the [keybindings](#keybindings):
|
|
92
|
-
|
|
93
|
-
```toml
|
|
94
|
-
[bindings.acceptSuggestion]
|
|
95
|
-
key = "tab"
|
|
96
|
-
# shift and ctrl are optional and default to false
|
|
97
|
-
shift = false
|
|
98
|
-
ctrl = false
|
|
99
|
-
|
|
100
|
-
[bindings.nextSuggestion]
|
|
101
|
-
key = "down"
|
|
102
|
-
|
|
103
|
-
[bindings.previousSuggestion]
|
|
104
|
-
key = "up"
|
|
105
|
-
|
|
106
|
-
[bindings.dismissSuggestions]
|
|
107
|
-
key = "escape"
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
Key names are matched against the Node.js [keypress](https://nodejs.org/api/readline.html#readlineemitkeypresseventsstream-interface) events.
|
|
111
|
-
|
|
112
|
-
## Contributing
|
|
113
|
-
|
|
114
|
-
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
|
115
|
-
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
|
116
|
-
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
|
117
|
-
|
|
118
|
-
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
|
|
119
|
-
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
|
|
120
|
-
provided by the bot. You will only need to do this once across all repos using our CLA.
|
|
121
|
-
|
|
122
|
-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
123
|
-
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
|
124
|
-
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
125
|
-
|
|
126
|
-
## Trademarks
|
|
127
|
-
|
|
128
|
-
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
|
|
129
|
-
trademarks or logos is subject to and must follow
|
|
130
|
-
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
131
|
-
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
132
|
-
Any use of third-party trademarks or logos are subject to those third-party's policies.
|
package/SECURITY.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
|
|
2
|
-
|
|
3
|
-
## Security
|
|
4
|
-
|
|
5
|
-
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).
|
|
6
|
-
|
|
7
|
-
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
|
|
8
|
-
|
|
9
|
-
## Reporting Security Issues
|
|
10
|
-
|
|
11
|
-
**Please do not report security vulnerabilities through public GitHub issues.**
|
|
12
|
-
|
|
13
|
-
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
|
|
14
|
-
|
|
15
|
-
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
|
|
16
|
-
|
|
17
|
-
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
|
18
|
-
|
|
19
|
-
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
|
20
|
-
|
|
21
|
-
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
|
22
|
-
* Full paths of source file(s) related to the manifestation of the issue
|
|
23
|
-
* The location of the affected source code (tag/branch/commit or direct URL)
|
|
24
|
-
* Any special configuration required to reproduce the issue
|
|
25
|
-
* Step-by-step instructions to reproduce the issue
|
|
26
|
-
* Proof-of-concept or exploit code (if possible)
|
|
27
|
-
* Impact of the issue, including how an attacker might exploit the issue
|
|
28
|
-
|
|
29
|
-
This information will help us triage your report more quickly.
|
|
30
|
-
|
|
31
|
-
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
|
|
32
|
-
|
|
33
|
-
## Preferred Languages
|
|
34
|
-
|
|
35
|
-
We prefer all communications to be in English.
|
|
36
|
-
|
|
37
|
-
## Policy
|
|
38
|
-
|
|
39
|
-
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
|
|
40
|
-
|
|
41
|
-
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
package/SUPPORT.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Support
|
|
2
|
-
|
|
3
|
-
## How to file issues and get help
|
|
4
|
-
|
|
5
|
-
This project uses GitHub Issues to track bugs and feature requests. Please search the existing
|
|
6
|
-
issues before filing new issues to avoid duplicates. For new issues, file your bug or
|
|
7
|
-
feature request as a new Issue.
|
|
8
|
-
|
|
9
|
-
For help and questions about using this project, create a new Github Discussion.
|
|
10
|
-
|
|
11
|
-
## Microsoft Support Policy
|
|
12
|
-
|
|
13
|
-
Support for this project is limited to the resources listed above.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import os from "node:os";
|
|
4
|
-
import { Command } from "commander";
|
|
5
|
-
import { getSuggestions } from "../runtime/runtime.js";
|
|
6
|
-
import { Shell } from "../utils/shell.js";
|
|
7
|
-
const action = async (input) => {
|
|
8
|
-
const suggestions = await getSuggestions(input, process.cwd(), os.platform() === "win32" ? Shell.Cmd : Shell.Bash);
|
|
9
|
-
process.stdout.write(JSON.stringify(suggestions));
|
|
10
|
-
process.exit(0);
|
|
11
|
-
};
|
|
12
|
-
const cmd = new Command("complete");
|
|
13
|
-
cmd.description(`generates a completion for the provided input`);
|
|
14
|
-
cmd.argument("<input>");
|
|
15
|
-
cmd.action(action);
|
|
16
|
-
export default cmd;
|
package/build/commands/doctor.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { Command } from "commander";
|
|
4
|
-
import { render } from "../ui/ui-doctor.js";
|
|
5
|
-
const action = async () => {
|
|
6
|
-
await render();
|
|
7
|
-
};
|
|
8
|
-
const cmd = new Command("doctor");
|
|
9
|
-
cmd.description(`checks the health of this inshellisense installation`);
|
|
10
|
-
cmd.action(action);
|
|
11
|
-
export default cmd;
|
package/build/commands/init.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { Command } from "commander";
|
|
4
|
-
import { createShellConfigs, initSupportedShells as shells, getShellSourceCommand } from "../utils/shell.js";
|
|
5
|
-
const supportedShells = shells.join(", ");
|
|
6
|
-
const action = (program) => async (shell, options) => {
|
|
7
|
-
if (options.generateFullConfigs) {
|
|
8
|
-
await createShellConfigs();
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
if (shell == null)
|
|
12
|
-
program.error(`Shell is required, supported shells: ${supportedShells}`, { exitCode: 1 });
|
|
13
|
-
if (!shells.map((s) => s.valueOf()).includes(shell)) {
|
|
14
|
-
program.error(`Unsupported shell: '${shell}', supported shells: ${supportedShells}`, { exitCode: 1 });
|
|
15
|
-
}
|
|
16
|
-
const config = getShellSourceCommand(shell);
|
|
17
|
-
process.stdout.write(`\n\n${config}\n`);
|
|
18
|
-
};
|
|
19
|
-
const cmd = new Command("init");
|
|
20
|
-
cmd.description(`generates shell configurations and prints the source command for the specified shell`);
|
|
21
|
-
cmd.argument("[shell]", `shell to generate for, supported shells: ${supportedShells}`);
|
|
22
|
-
cmd.option("--generate-full-configs");
|
|
23
|
-
cmd.action(action(cmd));
|
|
24
|
-
export default cmd;
|
package/build/commands/root.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { render, renderConfirmation } from "../ui/ui-root.js";
|
|
4
|
-
import { Shell, supportedShells as shells, setupZshDotfiles, setupBashPreExec } from "../utils/shell.js";
|
|
5
|
-
import { inferShell } from "../utils/shell.js";
|
|
6
|
-
import { loadConfig } from "../utils/config.js";
|
|
7
|
-
import log from "../utils/log.js";
|
|
8
|
-
import { loadAliases } from "../runtime/alias.js";
|
|
9
|
-
import { loadLocalSpecsSet } from "../runtime/runtime.js";
|
|
10
|
-
export const supportedShells = shells.join(", ");
|
|
11
|
-
export const action = (program) => async (options) => {
|
|
12
|
-
const inISTerm = process.env.ISTERM === "1";
|
|
13
|
-
if (options.check || inISTerm) {
|
|
14
|
-
process.stdout.write(renderConfirmation(inISTerm));
|
|
15
|
-
process.exit(0);
|
|
16
|
-
}
|
|
17
|
-
if (options.verbose)
|
|
18
|
-
await log.enable();
|
|
19
|
-
await loadConfig(program);
|
|
20
|
-
await loadLocalSpecsSet();
|
|
21
|
-
log.overrideConsole();
|
|
22
|
-
const shell = options.shell ?? (await inferShell());
|
|
23
|
-
if (shell == null) {
|
|
24
|
-
program.error(`Unable to identify shell, use the -s/--shell option to provide your shell`, { exitCode: 1 });
|
|
25
|
-
}
|
|
26
|
-
if (!shells.map((s) => s.valueOf()).includes(shell)) {
|
|
27
|
-
program.error(`Unsupported shell: '${shell}', supported shells: ${supportedShells}`, { exitCode: 1 });
|
|
28
|
-
}
|
|
29
|
-
if (shell == Shell.Zsh) {
|
|
30
|
-
await setupZshDotfiles();
|
|
31
|
-
}
|
|
32
|
-
else if (shell == Shell.Bash) {
|
|
33
|
-
await setupBashPreExec();
|
|
34
|
-
}
|
|
35
|
-
await loadAliases(shell);
|
|
36
|
-
await render(program, shell, options.test ?? false, options.login ?? false);
|
|
37
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { Command } from "commander";
|
|
4
|
-
import { loadConfig } from "../../utils/config.js";
|
|
5
|
-
import { getSpecNames, loadLocalSpecsSet } from "../../runtime/runtime.js";
|
|
6
|
-
import { getAliasNames, loadAliases } from "../../runtime/alias.js";
|
|
7
|
-
import { aliasSupportedShells } from "../../utils/shell.js";
|
|
8
|
-
const supportedShells = aliasSupportedShells.join(", ");
|
|
9
|
-
const action = (program) => async (options) => {
|
|
10
|
-
await loadConfig(program);
|
|
11
|
-
await loadLocalSpecsSet();
|
|
12
|
-
const { shell } = options;
|
|
13
|
-
if (shell && !aliasSupportedShells.map((s) => s.valueOf()).includes(shell)) {
|
|
14
|
-
program.error(`Unsupported shell: '${shell}', supported shells: ${supportedShells}`, { exitCode: 1 });
|
|
15
|
-
}
|
|
16
|
-
if (shell) {
|
|
17
|
-
await loadAliases(shell);
|
|
18
|
-
}
|
|
19
|
-
process.stdout.write(JSON.stringify([...getAliasNames(), ...getSpecNames()]));
|
|
20
|
-
process.exit(0);
|
|
21
|
-
};
|
|
22
|
-
const cmd = new Command("list");
|
|
23
|
-
cmd.description(`list the names of all available specs`);
|
|
24
|
-
cmd.option("-s, --shell <shell>", `shell to use alias specs, supported shells: ${supportedShells}`);
|
|
25
|
-
cmd.action(action(cmd));
|
|
26
|
-
export default cmd;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { Command } from "commander";
|
|
4
|
-
import { render } from "../ui/ui-uninstall.js";
|
|
5
|
-
const action = async () => {
|
|
6
|
-
await render();
|
|
7
|
-
};
|
|
8
|
-
const cmd = new Command("uninstall");
|
|
9
|
-
cmd.description(`removes all configuration for inshellisense`);
|
|
10
|
-
cmd.action(action);
|
|
11
|
-
export default cmd;
|
package/build/index.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT License.
|
|
4
|
-
/* eslint-disable header/header */
|
|
5
|
-
import { Command, Option } from "commander";
|
|
6
|
-
import complete from "./commands/complete.js";
|
|
7
|
-
import uninstall from "./commands/uninstall.js";
|
|
8
|
-
import init from "./commands/init.js";
|
|
9
|
-
import specs from "./commands/specs/root.js";
|
|
10
|
-
import doctor from "./commands/doctor.js";
|
|
11
|
-
import { action, supportedShells } from "./commands/root.js";
|
|
12
|
-
import { getVersion } from "./utils/version.js";
|
|
13
|
-
const program = new Command();
|
|
14
|
-
const hiddenOption = (flags, description) => {
|
|
15
|
-
const option = new Option(flags, description);
|
|
16
|
-
option.hidden = true;
|
|
17
|
-
return option;
|
|
18
|
-
};
|
|
19
|
-
program
|
|
20
|
-
.name("inshellisense")
|
|
21
|
-
.description("IDE style command line auto complete")
|
|
22
|
-
.version(await getVersion(), "-v, --version", "output the current version")
|
|
23
|
-
.action(action(program))
|
|
24
|
-
.option("-l, --login", `start shell as a login shell`)
|
|
25
|
-
.option("-s, --shell <shell>", `shell to use for command execution, supported shells: ${supportedShells}`)
|
|
26
|
-
.option("-c, --check", `check if shell is in an inshellisense session`)
|
|
27
|
-
.addOption(hiddenOption("-T, --test", "used to make e2e tests reproducible across machines"))
|
|
28
|
-
.option("-V, --verbose", `enable verbose logging`)
|
|
29
|
-
.passThroughOptions();
|
|
30
|
-
program.addCommand(complete);
|
|
31
|
-
program.addCommand(uninstall);
|
|
32
|
-
program.addCommand(init);
|
|
33
|
-
program.addCommand(specs);
|
|
34
|
-
program.addCommand(doctor);
|
|
35
|
-
program.parse();
|