diff --git a/README.md b/README.md
index c73853c..5408fb1 100644
--- a/README.md
+++ b/README.md
@@ -1,25 +1,27 @@
-# sa
+# inshellisense
-`sa` provides IDE style autocomplete, `inshellisense`, for shells. It's a terminal native runtime of for [autocomplete](https://github.com/withfig/autocomplete) which has support for 600+ command line tools. `sa` supports Windows, Linux, & MacOS.
+`inshellisense` provides IDE style autocomplete for shells. It's a terminal native runtime of for [autocomplete](https://github.com/withfig/autocomplete) which has support for 600+ command line tools. `inshellisense` supports Windows, Linux, & MacOS.
-

+
## Getting Started
### Installation
```shell
-npm install -g @microsoft/sa
+npm install -g @microsoft/inshellisense
```
### Quickstart
-After completing the installation, you can already run `sa --shell ` to start the autocomplete session for your desired shell. Additionally, you can bind `sa` to a keybinding of `CTRL+a` by running the below command. This brings the added advantages of automatically starting the autocomplete session with your current shell and injecting any accepted command into your shell's history.
+After completing the installation, you can already run `inshellisense --shell ` to start the autocomplete session for your desired shell. Additionally, you can bind `inshellisense` to a keybinding of `CTRL+a` by running the below command. This brings the added advantages of automatically starting the autocomplete session with your current shell and injecting any accepted command into your shell's history.
```shell
-sa bind
+inshellisense bind
```
+Additionally, inshellisense is also aliased under `is` after install for convenience.
+
## Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
diff --git a/package-lock.json b/package-lock.json
index fec1cd1..76a04fa 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,11 +1,11 @@
{
- "name": "@microsoft/sa",
+ "name": "@microsoft/inshellisense",
"version": "0.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
- "name": "@microsoft/sa",
+ "name": "@microsoft/inshellisense",
"version": "0.0.0",
"license": "MIT",
"dependencies": {
@@ -17,7 +17,8 @@
"wrap-ansi": "^8.1.0"
},
"bin": {
- "sa": "build/index.js"
+ "inshellisense": "build/index.js",
+ "is": "build/index.js"
},
"devDependencies": {
"@tsconfig/node18": "^18.2.2",
diff --git a/package.json b/package.json
index 561c20e..52c2e27 100644
--- a/package.json
+++ b/package.json
@@ -1,10 +1,11 @@
{
- "name": "@microsoft/sa",
+ "name": "@microsoft/inshellisense",
"version": "0.0.0",
"description": "IDE style command line auto complete",
"type": "module",
"bin": {
- "sa": "./build/index.js"
+ "inshellisense": "./build/index.js",
+ "is": "./build/index.js"
},
"files": [
"build/**",
@@ -21,16 +22,16 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/microsoft/sa.git"
+ "url": "git+https://github.com/microsoft/inshellisense.git"
},
"author": {
"name": "Microsoft Corporation"
},
"license": "MIT",
"bugs": {
- "url": "https://github.com/microsoft/sa/issues"
+ "url": "https://github.com/microsoft/inshellisense/issues"
},
- "homepage": "https://github.com/microsoft/sa#readme",
+ "homepage": "https://github.com/microsoft/inshellisense#readme",
"dependencies": {
"@withfig/autocomplete": "^2.633.0",
"chalk": "^5.3.0",
@@ -55,4 +56,4 @@
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
}
-}
+}
\ No newline at end of file
diff --git a/shell/key-bindings-powershell.ps1 b/shell/key-bindings-powershell.ps1
index 633ad8f..5b4efe0 100644
--- a/shell/key-bindings-powershell.ps1
+++ b/shell/key-bindings-powershell.ps1
@@ -12,15 +12,15 @@ Set-PSReadLineKeyHandler -Chord 'Ctrl+a' -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::KillLine()
[Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
- $sa = "$env:USERPROFILE\AppData\Roaming\npm\node_modules\@microsoft\sa\build\index.js"
+ $inshellisense = "$env:USERPROFILE\AppData\Roaming\npm\node_modules\@microsoft\inshellisense\build\index.js"
if ($command) {
- Start-Process -NoNewWindow -Wait "node" "$sa -c $command -s powershell"
+ Start-Process -NoNewWindow -Wait "node" "$inshellisense -c $command -s powershell"
}
else {
- Start-Process -NoNewWindow -Wait "node" "$sa -s powershell"
+ Start-Process -NoNewWindow -Wait "node" "$inshellisense -s powershell"
}
- $executedCommand = node $sa --history
+ $executedCommand = node $inshellisense --history
if ($executedCommand) {
[Microsoft.PowerShell.PSConsoleReadLine]::AddToHistory($executedCommand)
}
diff --git a/shell/key-bindings-pwsh.ps1 b/shell/key-bindings-pwsh.ps1
index 8e37ba8..c758f3a 100644
--- a/shell/key-bindings-pwsh.ps1
+++ b/shell/key-bindings-pwsh.ps1
@@ -11,15 +11,15 @@ Set-PSReadLineKeyHandler -Chord 'Ctrl+a' -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::BeginningOfLine()
[Microsoft.PowerShell.PSConsoleReadLine]::KillLine()
- $sa = "$env:USERPROFILE\AppData\Roaming\npm\node_modules\@microsoft\sa\build\index.js"
+ $inshellisense = "$env:USERPROFILE\AppData\Roaming\npm\node_modules\@microsoft\inshellisense\build\index.js"
if ($command) {
- Start-Process -NoNewWindow -Wait "node" "$sa -c $command -s pwsh"
+ Start-Process -NoNewWindow -Wait "node" "$inshellisense -c $command -s pwsh"
}
else {
- Start-Process -NoNewWindow -Wait "node" "$sa -s pwsh"
+ Start-Process -NoNewWindow -Wait "node" "$inshellisense -s pwsh"
}
- $executedCommand = node $sa --history
+ $executedCommand = node $inshellisense --history
if ($executedCommand) {
[Microsoft.PowerShell.PSConsoleReadLine]::AddToHistory($executedCommand)
}
diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash
index a62d22a..029dc1d 100644
--- a/shell/key-bindings.bash
+++ b/shell/key-bindings.bash
@@ -1,7 +1,7 @@
-__sa__() {
- sa -c "$READLINE_LINE" -s bash
- history -s $(sa --history)
+__inshellisense__() {
+ inshellisense -c "$READLINE_LINE" -s bash
+ history -s $(inshellisense --history)
READLINE_LINE=
}
-bind -x '"\C-a": __sa__'
\ No newline at end of file
+bind -x '"\C-a": __inshellisense__'
\ No newline at end of file
diff --git a/src/index.ts b/src/index.ts
index bbdde8c..8172321 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -13,7 +13,7 @@ import { action, supportedShells } from "./commands/root.js";
const program = new Command();
program
- .name("sa")
+ .name("inshellisense")
.description("IDE style command line auto complete")
.version("0.0.0", "-v, --version", "output the current version")
.option("-s, --shell ", `shell to use for command execution, supported shells: ${supportedShells}`)
diff --git a/src/utils/bindings.ts b/src/utils/bindings.ts
index 8339810..47b9826 100644
--- a/src/utils/bindings.ts
+++ b/src/utils/bindings.ts
@@ -10,6 +10,7 @@ import url from "node:url";
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
+const cacheFolder = ".inshellisense";
export enum Shell {
Bash = "bash",
@@ -20,16 +21,16 @@ export enum Shell {
export const supportedShells = [Shell.Bash, Shell.Powershell, Shell.Pwsh];
const bashScriptCommand = (): string => {
- return `[ -f ~/.sa/key-bindings.bash ] && source ~/.sa/key-bindings.bash`;
+ return `[ -f ~/${cacheFolder}/key-bindings.bash ] && source ~/${cacheFolder}/key-bindings.bash`;
};
const powershellScriptCommand = (): string => {
- const bindingsPath = path.join(os.homedir(), ".sa", "key-bindings-powershell.ps1");
+ const bindingsPath = path.join(os.homedir(), cacheFolder, "key-bindings-powershell.ps1");
return `if(Test-Path '${bindingsPath}' -PathType Leaf){. ${bindingsPath}}`;
};
const pwshScriptCommand = (): string => {
- const bindingsPath = path.join(os.homedir(), ".sa", "key-bindings-pwsh.ps1");
+ const bindingsPath = path.join(os.homedir(), cacheFolder, "key-bindings-pwsh.ps1");
return `if(Test-Path '${bindingsPath}' -PathType Leaf){. ${bindingsPath}}`;
};
@@ -46,9 +47,9 @@ const pwshConfigPath = (): string => {
};
export const availableBindings = async (): Promise => {
- const saConfigPath = path.join(os.homedir(), ".sa");
- if (!fs.existsSync(saConfigPath)) {
- await fsAsync.mkdir(saConfigPath);
+ const cliConfigPath = path.join(os.homedir(), cacheFolder);
+ if (!fs.existsSync(cliConfigPath)) {
+ await fsAsync.mkdir(cliConfigPath);
}
const bindings = [];
@@ -85,15 +86,15 @@ export const availableBindings = async (): Promise => {
};
export const bind = async (shell: Shell): Promise => {
- const saConfigPath = path.join(os.homedir(), ".sa");
- if (!fs.existsSync(saConfigPath)) {
- await fsAsync.mkdir(saConfigPath);
+ const cliConfigPath = path.join(os.homedir(), cacheFolder);
+ if (!fs.existsSync(cliConfigPath)) {
+ await fsAsync.mkdir(cliConfigPath);
}
switch (shell) {
case Shell.Bash: {
const bashConfigPath = path.join(os.homedir(), ".bashrc");
await fsAsync.appendFile(bashConfigPath, `\n${bashScriptCommand()}`);
- await fsAsync.copyFile(path.join(__dirname, "..", "..", "shell", "key-bindings.bash"), path.join(os.homedir(), ".sa", "key-bindings.bash"));
+ await fsAsync.copyFile(path.join(__dirname, "..", "..", "shell", "key-bindings.bash"), path.join(os.homedir(), cacheFolder, "key-bindings.bash"));
break;
}
case Shell.Powershell: {
@@ -101,13 +102,13 @@ export const bind = async (shell: Shell): Promise => {
await fsAsync.appendFile(powershellConfigPath, `\n${powershellScriptCommand()}`);
await fsAsync.copyFile(
path.join(__dirname, "..", "..", "shell", "key-bindings-powershell.ps1"),
- path.join(os.homedir(), ".sa", "key-bindings-powershell.ps1"),
+ path.join(os.homedir(), cacheFolder, "key-bindings-powershell.ps1"),
);
break;
}
case Shell.Pwsh: {
await fsAsync.appendFile(pwshConfigPath(), `\n${pwshScriptCommand()}`);
- await fsAsync.copyFile(path.join(__dirname, "..", "..", "shell", "key-bindings-pwsh.ps1"), path.join(os.homedir(), ".sa", "key-bindings-pwsh.ps1"));
+ await fsAsync.copyFile(path.join(__dirname, "..", "..", "shell", "key-bindings-pwsh.ps1"), path.join(os.homedir(), cacheFolder, "key-bindings-pwsh.ps1"));
break;
}
}
diff --git a/src/utils/cache.ts b/src/utils/cache.ts
index e41f46e..28bc75e 100644
--- a/src/utils/cache.ts
+++ b/src/utils/cache.ts
@@ -6,8 +6,9 @@ import path from "node:path";
import fsAsync from "node:fs/promises";
import fs from "node:fs";
-const folderPath = path.join(os.homedir(), ".sa");
-const cachePath = path.join(os.homedir(), ".sa", "sa.cache");
+const cacheFolder = ".inshellisense";
+const folderPath = path.join(os.homedir(), cacheFolder);
+const cachePath = path.join(os.homedir(), cacheFolder, "inshellisense.cache");
export const saveCommand = async (command: string) => {
if (!fs.existsSync(folderPath)) {