From 34775e9e6997c01fa52d0fbbf306cea16e922659 Mon Sep 17 00:00:00 2001 From: Moulick Aggarwal Date: Fri, 26 May 2023 06:05:18 +0200 Subject: [PATCH] Remove oc alias (#178) oc is pretty wellknow alias for OpenShift CLI Signed-off-by: Moulick Aggarwal --- README.md | 34 ++++++++++++------------- out/cli.cjs | 15 +++++------ package-lock.json | 1 - package.json | 1 - src/api.ts | 2 +- src/commands/commit.ts | 2 +- src/commands/prepare-commit-msg-hook.ts | 2 +- 7 files changed, 27 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 608beea..0964ba9 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ Interactive rebase (`rebase -i`) changes commit SHA, so commit history in remote ## Setup OpenCommit as a CLI -You can use OpenCommit by simply running it via CLI like this `oc`. 2 seconds and your staged changes are committed with a meaningful message. +You can use OpenCommit by simply running it via CLI like this `oco`. 2 seconds and your staged changes are committed with a meaningful message. 1. Install OpenCommit globally to use in any repository: @@ -103,7 +103,7 @@ git add opencommit ``` -You can also use the `oc` shortcut: +You can also use the `oco` shortcut: ```sh git add @@ -133,19 +133,19 @@ Local config still has more priority as Global config, but you may set `OCO_MODE Simply run any of the variable above like this: ```sh -oc config set OCO_OPENAI_API_KEY=gpt-4 +oco config set OCO_OPENAI_API_KEY=gpt-4 ``` Configure [GitMoji](https://gitmoji.dev/) to preface a message. ```sh -oc config set OCO_EMOJI=true +oco config set OCO_EMOJI=true ``` To remove preface emoji: ```sh -oc config set OCO_EMOJI=false +oco config set OCO_EMOJI=false ``` ### Switch to GPT-4 @@ -155,7 +155,7 @@ By default OpenCommit uses GPT-3.5-turbo (ChatGPT). You may switch to GPT-4 which performs better, but costs ~x15 times more 🤠 ```sh -oc config set OCO_MODEL=gpt-4 +oco config set OCO_MODEL=gpt-4 ``` Make sure you do lowercase `gpt-4` and you have API access to the 4th model. Even if you have ChatGPT+ it doesn't necessarily mean that you have API access to GPT-4. @@ -166,25 +166,25 @@ To globally specify the language used to generate commit messages: ```sh # de, German ,Deutsch -oc config set OCO_LANGUAGE=de -oc config set OCO_LANGUAGE=German -oc config set OCO_LANGUAGE=Deutsch +oco config set OCO_LANGUAGE=de +oco config set OCO_LANGUAGE=German +oco config set OCO_LANGUAGE=Deutsch # fr, French, française -oc config set OCO_LANGUAGE=fr -oc config set OCO_LANGUAGE=French -oc config set OCO_LANGUAGE=française +oco config set OCO_LANGUAGE=fr +oco config set OCO_LANGUAGE=French +oco config set OCO_LANGUAGE=française ``` -The default language set is **English** +The default language set is **English** All available languages are currently listed in the [i18n](https://github.com/di-sukharev/opencommit/tree/master/src/i18n) folder ### Git flags -The `opencommit` or `oc` commands can be used in place of the `git commit -m "${generatedMessage}"` command. This means that any regular flags that are used with the `git commit` command will also be applied when using `opencommit` or `oc`. +The `opencommit` or `oco` commands can be used in place of the `git commit -m "${generatedMessage}"` command. This means that any regular flags that are used with the `git commit` command will also be applied when using `opencommit` or `oco`. ```sh -oc --no-verify +oco --no-verify ``` is translated to : @@ -213,13 +213,13 @@ You can set OpenCommit as Git [`prepare-commit-msg`](https://git-scm.com/docs/gi To set the hook: ```sh -oc hook set +oco hook set ``` To unset the hook: ```sh -oc hook unset +oco hook unset ``` To use the hook: diff --git a/out/cli.cjs b/out/cli.cjs index 53e21ce..f296fcb 100755 --- a/out/cli.cjs +++ b/out/cli.cjs @@ -16289,7 +16289,6 @@ var package_default = { main: "cli.js", bin: { opencommit: "./out/cli.cjs", - oc: "./out/cli.cjs", oco: "./out/cli.cjs" }, repository: { @@ -16904,7 +16903,7 @@ ${import_picocolors.default.magenta("\u25CB")} ${t} let i2 = 0, c3 = 0; n = setInterval(() => { let l = C3[i2]; - process.stdout.write(import_sisteransi2.cursor.move(-999, -1)), process.stdout.write(`${import_picocolors.default.magenta(l)} ${t}${Math.floor(c3) >= 1 ? ".".repeat(Math.floor(c3)).slice(0, 3) : ""} + process.stdout.write(import_sisteransi2.cursor.move(-999, -1)), process.stdout.write(`${import_picocolors.default.magenta(l)} ${t}${Math.floor(c3) >= 1 ? ".".repeat(Math.floor(c3)).slice(0, 3) : ""} `), i2 = i2 === C3.length - 1 ? 0 : i2 + 1, c3 = c3 === C3.length ? 0 : c3 + 0.125; }, s); }, stop(t = "") { @@ -21789,18 +21788,18 @@ index ad4db42..f3b18a9 100644 @@ -10,7 +10,7 @@ import { initWinstonLogger(); - + const app = express(); -const port = 7799; +const PORT = 7799; - + app.use(express.json()); - + @@ -34,6 +34,6 @@ app.use((_, res, next) => { // ROUTES app.use(PROTECTED_ROUTER_URL, protectedRouter); - + -app.listen(port, () => { - console.log(\`Server listening on port \${port}\`); +app.listen(process.env.PORT || PORT, () => { @@ -21903,7 +21902,7 @@ var prepareCommitMessageHook = async (isStageAllFlag = false) => { if (changedFiles) await gitAdd({ files: changedFiles }); else { - ce("No changes detected, write some code and run `oc` again"); + ce("No changes detected, write some code and run `oco` again"); process.exit(1); } } @@ -22037,7 +22036,7 @@ async function commit(extraArgs2 = [], isStageAllFlag = false) { if (changedFiles2) await gitAdd({ files: changedFiles2 }); else { - ce("No changes detected, write some code and run `oc` again"); + ce("No changes detected, write some code and run `oco` again"); process.exit(1); } } diff --git a/package-lock.json b/package-lock.json index 31af7bd..ffe0853 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,6 @@ "openai": "^3.2.1" }, "bin": { - "oc": "out/cli.cjs", "oco": "out/cli.cjs", "opencommit": "out/cli.cjs" }, diff --git a/package.json b/package.json index 74c26e5..f1ae5c9 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "main": "cli.js", "bin": { "opencommit": "./out/cli.cjs", - "oc": "./out/cli.cjs", "oco": "./out/cli.cjs" }, "repository": { diff --git a/src/api.ts b/src/api.ts index b7a05b0..d863fa6 100644 --- a/src/api.ts +++ b/src/api.ts @@ -21,7 +21,7 @@ if (!apiKey && command !== 'config' && mode !== CONFIG_MODES.set) { intro('opencommit'); outro( - 'OCO_OPENAI_API_KEY is not set, please run `oc config set OCO_OPENAI_API_KEY=. Make sure you add payment details, so API works.`' + 'OCO_OPENAI_API_KEY is not set, please run `oco config set OCO_OPENAI_API_KEY=. Make sure you add payment details, so API works.`' ); outro( 'For help look into README https://github.com/di-sukharev/opencommit#setup' diff --git a/src/commands/commit.ts b/src/commands/commit.ts index b6c337b..15760f7 100644 --- a/src/commands/commit.ts +++ b/src/commands/commit.ts @@ -138,7 +138,7 @@ export async function commit( if (changedFiles) await gitAdd({ files: changedFiles }); else { - outro('No changes detected, write some code and run `oc` again'); + outro('No changes detected, write some code and run `oco` again'); process.exit(1); } } diff --git a/src/commands/prepare-commit-msg-hook.ts b/src/commands/prepare-commit-msg-hook.ts index 37a3137..54f7626 100644 --- a/src/commands/prepare-commit-msg-hook.ts +++ b/src/commands/prepare-commit-msg-hook.ts @@ -24,7 +24,7 @@ export const prepareCommitMessageHook = async ( if (changedFiles) await gitAdd({ files: changedFiles }); else { - outro('No changes detected, write some code and run `oc` again'); + outro('No changes detected, write some code and run `oco` again'); process.exit(1); } }