Skip to content

Commit

Permalink
Update curl and ssh to have history completions, add index of all specs
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivan-sean committed Nov 11, 2021
1 parent b3f762b commit 7c81b55
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 4 deletions.
7 changes: 7 additions & 0 deletions generate-index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as fs from "fs";
import * as glob from "glob";

const files = glob
.sync("**/*.ts", { cwd: `${process.cwd()}/src` })
.map((x) => `"${x.slice(0, -3)}"`);
fs.writeFileSync("build/index.js", `module.exports=[${files.join(",")}]`);
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"dev": "npx @withfig/autocomplete-tools dev",
"create-spec": "npx @withfig/autocomplete-tools create-spec",
"build": "npx @withfig/autocomplete-tools compile",
"build": "npx @withfig/autocomplete-tools compile && npx ts-node generate-index",
"lint": "eslint '**/*.ts' && npx prettier --check '**/*.ts'",
"lint:fix": "eslint '**/*.ts' --fix && npx prettier --write '**/*.ts'",
"test": "tsc --noEmit && echo 'All specs passed validation. You are ready to push!'",
Expand Down Expand Up @@ -88,5 +88,10 @@
"progress": "^2.0.3",
"ts-node": "^9.1.1",
"typescript": "^4.2.3"
},
"dependencies": {
"@types/glob": "^7.2.0",
"fs": "^0.0.1-security",
"glob": "^7.2.0"
}
}
3 changes: 1 addition & 2 deletions src/cd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ const completionSpec: Fig.Spec = {
name: "cd",
description: "Change the shell working directory",
args: {
template: "folders",
template: ["folders"],
// Add an additional hidden suggestion so users can execute on it if they want to

suggestions: [
{
name: "-",
Expand Down
2 changes: 1 addition & 1 deletion src/curl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const completionSpec: Fig.Spec = {
name: "curl",
description: "Transfer a URL",
args: { name: "URL" },
args: { name: "URL", template: "history" },
options: [
{
name: ["-a", "--append"],
Expand Down
1 change: 1 addition & 0 deletions src/ssh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const completionSpec: Fig.Spec = {
},
},
knownHosts,
{ template: "history" },
],
},
options: [
Expand Down
7 changes: 7 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"ts-node": {
"transpileOnly": true,
"files": true,
"compilerOptions": {
"module": "commonjs"
}
},
"compilerOptions": {
"moduleResolution": "node",
"outDir": "./build",
Expand Down

0 comments on commit 7c81b55

Please sign in to comment.