Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add command gum current to show user config in current directory #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ Commands:
use [options] <group-name> Use one group name for user config
--global Git global config
delete <group-name> Delete one group
current Show user config in current directory
help [command] display help for command
```

## Change Log

### v1.0.6

- feat: Add command `gum current` to show user config in current directory

### v1.0.5

- feat: Support `gum use <group-name> --global` commands that are not Git repositories
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gauseen/gum",
"version": "1.0.5",
"version": "1.0.6",
"description": "git multiple user config manager",
"bin": "./bin/index.js",
"scripts": {},
Expand Down
18 changes: 16 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,24 @@ program

program.command('delete <group-name>').description('Delete one group').action(onDelete);

program
.command('current')
.description('Show user config in current directory')
.action(onCurrent);

program.parse(process.argv);

function printCurrentUser(using) {
printer(`Currently used name=${using.name} email=${using.email}`, 'yellow');
}

function onList() {
const allConfig = getAllConfigInfo();
const using = getUsingGitUserConfig();
const tableData = getPrintTableData(allConfig);

// currently used user info
printer(`Currently used name=${using.name} email=${using.email}`, 'yellow');
printCurrentUser(using);

// git user config group list
const pt = new Table();
Expand Down Expand Up @@ -115,7 +124,7 @@ function onUse(groupName, options) {
printer(`Global using name=${globalGitUser.name} email=${globalGitUser.email}`, 'green');
}

printer(`Currently used name=${using.name} email=${using.email}`, 'yellow');
printCurrentUser(using);
console.log(' ');
} else {
printer(`${groupName} is invalid group name`, 'red');
Expand All @@ -141,3 +150,8 @@ function onDelete(groupName) {
console.log(' ');
});
}

function onCurrent() {
const using = getUsingGitUserConfig();
printCurrentUser(using);
}