mirror of
https://github.com/pomber/git-history.git
synced 2024-11-22 23:13:20 +03:00
Add validations
This commit is contained in:
parent
202f85d83a
commit
456dc408e6
16
cli/cli.js
16
cli/cli.js
@ -2,8 +2,22 @@
|
||||
|
||||
const runServer = require("./server");
|
||||
const getCommits = require("./git");
|
||||
const fs = require("fs");
|
||||
|
||||
const path = process.argv.slice(2);
|
||||
const path = process.argv[2];
|
||||
|
||||
if (!path || path === "--help") {
|
||||
console.log(`Usage:
|
||||
|
||||
githistory some/file.ext
|
||||
`);
|
||||
process.exit();
|
||||
}
|
||||
|
||||
if (!fs.existsSync(path)) {
|
||||
console.log(`File not found: ${path}`);
|
||||
process.exit();
|
||||
}
|
||||
|
||||
const commitsPromise = getCommits(path);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user