gitsu-cli 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +22 -3
- package/lib/package.json +5 -12
- package/lib/src/app.js +1 -1
- package/lib/src/functions/get-current-choice.js +1 -1
- package/lib/src/functions/save-git-config.js +5 -2
- package/package.json +2 -2
- package/src/app.ts +1 -1
- package/src/functions/get-current-choice.ts +1 -1
- package/src/functions/save-git-config.ts +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.0.5](https://github.com/jamieweavis/gitsu/compare/v1.0.4...v1.0.5) (2025-03-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* improve app description ([5016374](https://github.com/jamieweavis/gitsu/commit/5016374e422875fde42859da6386bec62bd57673))
|
|
7
|
+
|
|
8
|
+
## [1.0.4](https://github.com/jamieweavis/gitsu/compare/v1.0.3...v1.0.4) (2025-03-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* save local and global git configs ([37c6b96](https://github.com/jamieweavis/gitsu/commit/37c6b960dddc41c180c6f99ec0a3c6e9bfd600fe))
|
|
14
|
+
|
|
1
15
|
## [1.0.3](https://github.com/jamieweavis/gitsu/compare/v1.0.2...v1.0.3) (2025-03-16)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# gitsu
|
|
2
2
|
|
|
3
|
-
> 🥷 Command line util for quickly & easily switching git
|
|
3
|
+
> 🥷 Command line util for quickly & easily switching git identities
|
|
4
4
|
|
|
5
5
|
[](https://github.com/jamieweavis/gitsu/actions)
|
|
6
6
|
[](https://npmjs.com/package/gitsu-cli)
|
|
@@ -24,12 +24,14 @@ gitsu
|
|
|
24
24
|
|
|
25
25
|
List users stored in your `~/.gitsurc` config
|
|
26
26
|
```sh
|
|
27
|
-
gitsu --list
|
|
27
|
+
gitsu --list
|
|
28
|
+
gitsu -l
|
|
28
29
|
```
|
|
29
30
|
|
|
30
31
|
Open your `~/.gitsurc` config for editing in your default editor
|
|
31
32
|
```sh
|
|
32
|
-
gitsu --edit
|
|
33
|
+
gitsu --edit
|
|
34
|
+
gitsu -e
|
|
33
35
|
```
|
|
34
36
|
|
|
35
37
|
## Building
|
|
@@ -61,8 +63,25 @@ Unlink the local package from your global npm modules
|
|
|
61
63
|
npm unlink gitsu-cli -g
|
|
62
64
|
```
|
|
63
65
|
|
|
66
|
+
## Config
|
|
67
|
+
|
|
68
|
+
When you run `gitsu` for the first time, a `.gitsurc` file is created in your home directory. This file is used to store your git identities.
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
[
|
|
72
|
+
{ "name": "John", "email": "john.doe@gmail.com" },
|
|
73
|
+
{ "name": "John Doe", "email": "john.doe@corporate.com" },
|
|
74
|
+
{ "name": "Johnny", "email": "johnny@startup.io" }
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
|
|
64
79
|
## Built With
|
|
65
80
|
|
|
66
81
|
- [Node.js](https://github.com/nodejs/node)
|
|
67
82
|
- [TypeScript](https://github.com/microsoft/TypeScript)
|
|
68
83
|
- [Commander.js](https://github.com/tj/commander.js)
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
package/lib/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitsu-cli",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Command line util for quickly & easily switching git
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "Command line util for quickly & easily switching git identities",
|
|
5
5
|
"author": "Jamie Weavis",
|
|
6
6
|
"homepage": "https://github.com/jamieweavis/gitsu#readme",
|
|
7
7
|
"license": "MIT",
|
|
@@ -65,9 +65,7 @@
|
|
|
65
65
|
"ts-node-dev": "^2.0.0"
|
|
66
66
|
},
|
|
67
67
|
"release": {
|
|
68
|
-
"branches": [
|
|
69
|
-
"main"
|
|
70
|
-
],
|
|
68
|
+
"branches": ["main"],
|
|
71
69
|
"plugins": [
|
|
72
70
|
"@semantic-release/changelog",
|
|
73
71
|
"@semantic-release/commit-analyzer",
|
|
@@ -78,14 +76,9 @@
|
|
|
78
76
|
]
|
|
79
77
|
},
|
|
80
78
|
"lint-staged": {
|
|
81
|
-
"*.ts": [
|
|
82
|
-
"biome format --write",
|
|
83
|
-
"biome lint --write"
|
|
84
|
-
]
|
|
79
|
+
"*.ts": ["biome format --write", "biome lint --write"]
|
|
85
80
|
},
|
|
86
81
|
"commitlint": {
|
|
87
|
-
"extends": [
|
|
88
|
-
"@commitlint/config-conventional"
|
|
89
|
-
]
|
|
82
|
+
"extends": ["@commitlint/config-conventional"]
|
|
90
83
|
}
|
|
91
84
|
}
|
package/lib/src/app.js
CHANGED
|
@@ -10,7 +10,7 @@ const edit_1 = __importDefault(require("./commands/edit"));
|
|
|
10
10
|
const init_1 = __importDefault(require("./commands/init"));
|
|
11
11
|
const list_1 = __importDefault(require("./commands/list"));
|
|
12
12
|
const bootstrap = () => {
|
|
13
|
-
commander_1.program.description('Command line util for quickly & easily switching git
|
|
13
|
+
commander_1.program.description('Command line util for quickly & easily switching git identities');
|
|
14
14
|
commander_1.program.version(package_json_1.version);
|
|
15
15
|
commander_1.program.option('-e, --edit', 'edit ~/.gitsurc with your EDITOR');
|
|
16
16
|
commander_1.program.option('-l, --list', 'list users stored in ~/.gitsurc');
|
|
@@ -25,7 +25,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
25
25
|
return (0, choice_1.formatChoice)({ name, email });
|
|
26
26
|
}
|
|
27
27
|
catch (error) {
|
|
28
|
-
console.error(`${log_symbols_1.default.error} ${chalk_1.default.red('Failed to fetch current git
|
|
28
|
+
console.error(`${log_symbols_1.default.error} ${chalk_1.default.red('Failed to fetch current git identity')}`, error);
|
|
29
29
|
return '';
|
|
30
30
|
}
|
|
31
31
|
});
|
|
@@ -12,11 +12,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const node_child_process_1 =
|
|
15
|
+
const node_child_process_1 = require("node:child_process");
|
|
16
16
|
const log_symbols_1 = __importDefault(require("log-symbols"));
|
|
17
17
|
exports.default = (user) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
18
|
try {
|
|
19
|
-
|
|
19
|
+
// If user is in a git repo, save user to local git config
|
|
20
|
+
yield (0, node_child_process_1.exec)(`cd ${process.cwd()} && git config user.name "${user.name}" && git config user.email "${user.email}"`);
|
|
21
|
+
// Save user to global git config
|
|
22
|
+
yield (0, node_child_process_1.exec)(`git config --global user.name "${user.name}" && git config --global user.email "${user.email}"`);
|
|
20
23
|
return true;
|
|
21
24
|
}
|
|
22
25
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitsu-cli",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Command line util for quickly & easily switching git
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "Command line util for quickly & easily switching git identities",
|
|
5
5
|
"author": "Jamie Weavis",
|
|
6
6
|
"homepage": "https://github.com/jamieweavis/gitsu#readme",
|
|
7
7
|
"license": "MIT",
|
package/src/app.ts
CHANGED
|
@@ -9,7 +9,7 @@ import list from './commands/list';
|
|
|
9
9
|
|
|
10
10
|
const bootstrap = () => {
|
|
11
11
|
program.description(
|
|
12
|
-
'Command line util for quickly & easily switching git
|
|
12
|
+
'Command line util for quickly & easily switching git identities',
|
|
13
13
|
);
|
|
14
14
|
program.version(version);
|
|
15
15
|
program.option('-e, --edit', 'edit ~/.gitsurc with your EDITOR');
|
|
@@ -15,7 +15,7 @@ export default async (): Promise<string> => {
|
|
|
15
15
|
return formatChoice({ name, email });
|
|
16
16
|
} catch (error) {
|
|
17
17
|
console.error(
|
|
18
|
-
`${logSymbols.error} ${chalk.red('Failed to fetch current git
|
|
18
|
+
`${logSymbols.error} ${chalk.red('Failed to fetch current git identity')}`,
|
|
19
19
|
error,
|
|
20
20
|
);
|
|
21
21
|
return '';
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { exec } from 'node:child_process';
|
|
2
2
|
import logSymbols from 'log-symbols';
|
|
3
3
|
|
|
4
4
|
import type { IUser } from '../types';
|
|
5
5
|
|
|
6
6
|
export default async (user: IUser): Promise<boolean> => {
|
|
7
7
|
try {
|
|
8
|
-
|
|
8
|
+
// If user is in a git repo, save user to local git config
|
|
9
|
+
await exec(
|
|
10
|
+
`cd ${process.cwd()} && git config user.name "${user.name}" && git config user.email "${user.email}"`,
|
|
11
|
+
);
|
|
12
|
+
// Save user to global git config
|
|
13
|
+
await exec(
|
|
9
14
|
`git config --global user.name "${user.name}" && git config --global user.email "${user.email}"`,
|
|
10
15
|
);
|
|
11
|
-
|
|
12
16
|
return true;
|
|
13
17
|
} catch (error) {
|
|
14
18
|
console.error(`${logSymbols.error} Failed to save git config`, error);
|