-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a43293
commit b0e3f42
Showing
5 changed files
with
275 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
## StreakingMan Cli | ||
|
||
### 查看git当前配置名称和邮箱 | ||
``` | ||
skm check git | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const {execSync} = require('child_process') | ||
export const checkGit = (propName) => { | ||
if (!propName || propName === 'username') { | ||
console.log(`git config user.name ${execSync('git config user.name')}`) | ||
} | ||
if (!propName || propName === 'email') { | ||
console.log(`git config user.email ${execSync('git config user.email')}`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
const { program } = require('commander'); | ||
#!/usr/bin/env node | ||
import {checkGit} from "./actions/check-git"; | ||
|
||
const {program} = require('commander'); | ||
const fs = require('fs') | ||
const path = require('path') | ||
const {version} = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')).toString()) | ||
|
||
const CLINAME = 'skm' | ||
|
||
program.version(`${CLINAME}@${version}`, '-v') | ||
.helpOption('-h', '帮助信息') | ||
.usage('<command> [options]') | ||
.name(CLINAME) | ||
|
||
program.command('check git <propName>') | ||
.description('查看当前git配置用户名和邮箱') | ||
.action(checkGit) | ||
|
||
program.showHelpAfterError(`${CLINAME} -h 查看帮助`) | ||
program.addHelpCommand(false) | ||
program.parse(process.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.