refactor: rename project

Signed-off-by: Chapman Pendery <cpendery@vt.edu>
This commit is contained in:
Chapman Pendery
2023-10-07 20:53:06 -07:00
parent f339697532
commit 8713967f53
8 changed files with 38 additions and 52 deletions
+8 -24
View File
@@ -1,40 +1,24 @@
# clac
# sa
clac provides IDE style autocomplete aka `inshellisense` in every shell
`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.
<p align="center"><img alt="demo of clac working" src="https://github.com/microsoft/clac/assets/35637443/544f81dc-dada-40b5-bb1f-a736b4e58e73" height="300px"/></p>
clac is a terminal native implementation of fig's [autocomplete specs](https://github.com/withfig/autocomplete) which
provide support for 600+ command line tools.
## Supported Integrations
| Shells | IDEs | OS |
| ------------------ | ------------------ | ------- |
| bash | Visual Studio Code | Mac |
| Windows Powershell | | Windows |
| pwsh (Powershell) | | Linux |
<p align="center"><img alt="demo of sa working" src="https://github.com/microsoft/clac/assets/35637443/544f81dc-dada-40b5-bb1f-a736b4e58e73" height="300px"/></p>
## Getting Started
### Installation
#### MacOS, Linux, & Windows
```shell
go install github.com/microsoft/clac@latest
npm install -g @microsoft/sa
```
### Quickstart
After completing the installation, bind `clac` to the terminal you'd like to use
it with via the `clac bind [shell]` command. This will create a custom keybinding
for `CTRL+a` to trigger the autocomplete session & execution.
After completing the installation, you can already run `sa --shell <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.
### AI Autocomplete
Some generators use Open AI's api to generate intelligent solutions to your commands.
To use this feature, you'll need to set the `CLAC_AI_TOKEN` environment variable to your Open AI api key.
```shell
sa bind
```
## Contributing
+4 -4
View File
@@ -1,11 +1,11 @@
{
"name": "@microsoft/clac",
"name": "@microsoft/sa",
"version": "0.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@microsoft/clac",
"name": "@microsoft/sa",
"version": "0.0.0",
"license": "MIT",
"dependencies": {
@@ -17,7 +17,7 @@
"wrap-ansi": "^8.1.0"
},
"bin": {
"clac": "build/index.js"
"sa": "build/index.js"
},
"devDependencies": {
"@tsconfig/node18": "^18.2.2",
@@ -9509,4 +9509,4 @@
"integrity": "sha512-N+d4UJSJbt/R3wqY7Coqs5pcV0aUj2j9IaQ3rNj9bVCLld8tTGKRa2USARjnvZJWVx1NDmQev8EknoczaOQDOA=="
}
}
}
}
+5 -5
View File
@@ -1,10 +1,10 @@
{
"name": "@microsoft/clac",
"name": "@microsoft/sa",
"version": "0.0.0",
"description": "IDE style command line auto complete",
"type": "module",
"bin": {
"clac": "./build/index.js"
"sa": "./build/index.js"
},
"files": [
"build/**",
@@ -18,16 +18,16 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/microsoft/clac.git"
"url": "git+https://github.com/microsoft/sa.git"
},
"author": {
"name": "Microsoft Corporation"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/microsoft/clac/issues"
"url": "https://github.com/microsoft/sa/issues"
},
"homepage": "https://github.com/microsoft/clac#readme",
"homepage": "https://github.com/microsoft/sa#readme",
"dependencies": {
"@withfig/autocomplete": "^2.633.0",
"chalk": "^5.3.0",
+7 -6
View File
@@ -3,7 +3,7 @@ Set-PSReadLineKeyHandler -Chord 'Ctrl+a' -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$command, [ref]$null)
$oldPrompt = $function:prompt
function prompt {"`r"}
function prompt { "`r" }
[Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt()
$prompt = $oldPrompt
@@ -11,14 +11,15 @@ Set-PSReadLineKeyHandler -Chord 'Ctrl+a' -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::BeginningOfLine()
[Microsoft.PowerShell.PSConsoleReadLine]::KillLine()
$clac = "$env:USERPROFILE\AppData\Roaming\npm\node_modules\@microsoft\clac\build\index.js"
$sa = "$env:USERPROFILE\AppData\Roaming\npm\node_modules\@microsoft\sa\build\index.js"
if ($command) {
Start-Process -NoNewWindow -Wait "node" "$clac -c $command -s powershell"
} else {
Start-Process -NoNewWindow -Wait "node" "$clac -s powershell"
Start-Process -NoNewWindow -Wait "node" "$sa -c $command -s powershell"
}
else {
Start-Process -NoNewWindow -Wait "node" "$sa -s powershell"
}
$executedCommand = node $clac --history
$executedCommand = node $sa --history
if ($executedCommand) {
[Microsoft.PowerShell.PSConsoleReadLine]::AddToHistory($executedCommand)
}
+7 -6
View File
@@ -3,7 +3,7 @@ Set-PSReadLineKeyHandler -Chord 'Ctrl+a' -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$command, [ref]$null)
$oldPrompt = $function:prompt
function prompt {"`r"}
function prompt { "`r" }
[Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt()
$prompt = $oldPrompt
@@ -11,14 +11,15 @@ Set-PSReadLineKeyHandler -Chord 'Ctrl+a' -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::BeginningOfLine()
[Microsoft.PowerShell.PSConsoleReadLine]::KillLine()
$clac = "$env:USERPROFILE\AppData\Roaming\npm\node_modules\@microsoft\clac\build\index.js"
$sa = "$env:USERPROFILE\AppData\Roaming\npm\node_modules\@microsoft\sa\build\index.js"
if ($command) {
Start-Process -NoNewWindow -Wait "node" "$clac -c $command -s pwsh"
} else {
Start-Process -NoNewWindow -Wait "node" "$clac -s pwsh"
Start-Process -NoNewWindow -Wait "node" "$sa -c $command -s pwsh"
}
else {
Start-Process -NoNewWindow -Wait "node" "$sa -s pwsh"
}
$executedCommand = node $clac --history
$executedCommand = node $sa --history
if ($executedCommand) {
[Microsoft.PowerShell.PSConsoleReadLine]::AddToHistory($executedCommand)
}
+4 -4
View File
@@ -1,6 +1,6 @@
__clac__() {
clac -c "$READLINE_LINE" -s bash
history -s $(clac --history)
__sa__() {
sa -c "$READLINE_LINE" -s bash
history -s $(sa --history)
}
bind -x '"\C-a": __clac__'
bind -x '"\C-a": __sa__'
+1 -1
View File
@@ -8,7 +8,7 @@ import { action, supportedShells } from "./commands/root.js";
const program = new Command();
program
.name("clac")
.name("sa")
.description("IDE style command line auto complete")
.version("0.0.0", "-v, --version", "output the current version")
.option("-s, --shell <shell>", `shell to use for command execution, supported shells: ${supportedShells}`)
+2 -2
View File
@@ -3,8 +3,8 @@ import path from "node:path";
import fsAsync from "node:fs/promises";
import fs from "node:fs";
const folderPath = path.join(os.homedir(), ".clac");
const cachePath = path.join(os.homedir(), ".clac", "clac.cache");
const folderPath = path.join(os.homedir(), ".sa");
const cachePath = path.join(os.homedir(), ".sa", "sa.cache");
export const saveCommand = async (command: string) => {
if (!fs.existsSync(folderPath)) {