Compare commits
10 commits
Author | SHA1 | Date | |
---|---|---|---|
12c6d3f841 |
|||
37b8a37d5f |
|||
ecd055d3eb |
|||
7038897594 |
|||
c44822ffa3 | |||
3f6eab94c1 |
|||
de3f5e697c |
|||
703db757bc |
|||
50ecd8ce86 |
|||
618e00b677 |
2 changed files with 30 additions and 30 deletions
34
index.ts
34
index.ts
|
@ -14,11 +14,15 @@ import {
|
||||||
import { execSync } from "child_process";
|
import { execSync } from "child_process";
|
||||||
import { program } from "commander";
|
import { program } from "commander";
|
||||||
|
|
||||||
|
import packageJson from "./package.json";
|
||||||
|
export const VERSION = packageJson.version;
|
||||||
|
|
||||||
const CLI_NAME = "pcli";
|
const CLI_NAME = "pcli";
|
||||||
|
|
||||||
program
|
program
|
||||||
.name("project-cli")
|
.name("project-cli")
|
||||||
.description("A cli for managing projects")
|
.description("A cli for managing projects")
|
||||||
|
.version(VERSION)
|
||||||
.action(async () => {
|
.action(async () => {
|
||||||
if (!fs.existsSync(configPath + "config.json")) {
|
if (!fs.existsSync(configPath + "config.json")) {
|
||||||
const createConfig = await confirm({
|
const createConfig = await confirm({
|
||||||
|
@ -90,29 +94,25 @@ program
|
||||||
choices: getProjects().map((project: Project) => project.name),
|
choices: getProjects().map((project: Project) => project.name),
|
||||||
});
|
});
|
||||||
|
|
||||||
process.chdir(getConfiguration().projectsDirectory + "/" + pickedProject);
|
console.log(
|
||||||
|
"__EXEC__ cd " +
|
||||||
|
getConfiguration().projectsDirectory +
|
||||||
|
"/" +
|
||||||
|
pickedProject,
|
||||||
|
);
|
||||||
|
|
||||||
console.log(getProjects());
|
console.log(getProjects());
|
||||||
});
|
});
|
||||||
|
|
||||||
program.command("init").action(() => {
|
program.command("init").action(() => {
|
||||||
console.log(`${CLI_NAME}() {
|
console.log(`${CLI_NAME}() {
|
||||||
local output
|
command ${CLI_NAME} "$@" | while IFS= read -r line; do
|
||||||
output=$(command ${CLI_NAME} "$@")
|
if [[ $line == __EXEC__* ]]; then
|
||||||
local exit_code=$?
|
eval "\${line#__EXEC__}"
|
||||||
|
else
|
||||||
if [ $exit_code -eq 0 ]; then
|
echo "$line"
|
||||||
echo "$output" | while IFS= read -r line; do
|
fi
|
||||||
if [[ $line == __EXEC__* ]]; then
|
done
|
||||||
eval "\${line#__EXEC__}"
|
|
||||||
else
|
|
||||||
echo "$line"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
else
|
|
||||||
echo "$output" >&2
|
|
||||||
return $exit_code
|
|
||||||
fi
|
|
||||||
}`);
|
}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
26
package-lock.json
generated
26
package-lock.json
generated
|
@ -636,9 +636,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@octokit/request": {
|
"node_modules/@octokit/request": {
|
||||||
"version": "10.0.2",
|
"version": "10.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.3.tgz",
|
||||||
"integrity": "sha512-iYj4SJG/2bbhh+iIpFmG5u49DtJ4lipQ+aPakjL9OKpsGY93wM8w06gvFbEQxcMsZcCvk5th5KkIm2m8o14aWA==",
|
"integrity": "sha512-V6jhKokg35vk098iBqp2FBKunk3kMTXlmq+PtbV9Gl3TfskWlebSofU9uunVKhUN7xl+0+i5vt0TGTG8/p/7HA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/endpoint": "^11.0.0",
|
"@octokit/endpoint": "^11.0.0",
|
||||||
|
@ -1398,13 +1398,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/bun": {
|
"node_modules/@types/bun": {
|
||||||
"version": "1.2.16",
|
"version": "1.2.17",
|
||||||
"resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.2.16.tgz",
|
"resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.2.17.tgz",
|
||||||
"integrity": "sha512-1aCZJ/6nSiViw339RsaNhkNoEloLaPzZhxMOYEa7OzRzO41IGg5n/7I43/ZIAW/c+Q6cT12Vf7fOZOoVIzb5BQ==",
|
"integrity": "sha512-l/BYs/JYt+cXA/0+wUhulYJB6a6p//GTPiJ7nV+QHa8iiId4HZmnu/3J/SowP5g0rTiERY2kfGKXEK5Ehltx4Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bun-types": "1.2.16"
|
"bun-types": "1.2.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/cacheable-request": {
|
"node_modules/@types/cacheable-request": {
|
||||||
|
@ -1481,9 +1481,9 @@
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "24.0.3",
|
"version": "24.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.4.tgz",
|
||||||
"integrity": "sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg==",
|
"integrity": "sha512-ulyqAkrhnuNq9pB76DRBTkcS6YsmDALy6Ua63V8OhrOBgbcYt6IOdzpw5P1+dyRIyMerzLkeYWBeOXPpA9GMAA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~7.8.0"
|
"undici-types": "~7.8.0"
|
||||||
|
@ -1669,9 +1669,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/bun-types": {
|
"node_modules/bun-types": {
|
||||||
"version": "1.2.16",
|
"version": "1.2.17",
|
||||||
"resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.2.16.tgz",
|
"resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.2.17.tgz",
|
||||||
"integrity": "sha512-ciXLrHV4PXax9vHvUrkvun9VPVGOVwbbbBF/Ev1cXz12lyEZMoJpIJABOfPcN9gDJRaiKF9MVbSygLg4NXu3/A==",
|
"integrity": "sha512-ElC7ItwT3SCQwYZDYoAH+q6KT4Fxjl8DtZ6qDulUFBmXA8YB4xo+l54J9ZJN+k2pphfn9vk7kfubeSd5QfTVJQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue