gitlify
Version:
A powerful CLI tool to analyze uncommitted git changes with detailed reports, function detection, and beautiful terminal output
61 lines (52 loc) ⢠1.53 kB
JavaScript
const { GitLify } = require('../src/index.js');
const InputValidator = require('../src/utils/validator.js');
const { ErrorHandler } = require('../src/utils/error-handler.js');
// Parse command line arguments
const args = process.argv.slice(2);
const options = {
verbose: args.includes('--verbose') || args.includes('-v'),
json: args.includes('--json') || args.includes('-j'),
files: args.includes('--files') || args.includes('-f'),
summary: args.includes('--summary') || args.includes('-s'),
help: args.includes('--help') || args.includes('-h')
};
// Validate options
try {
InputValidator.validateOptions(options);
} catch (error) {
console.error('ā Invalid options:', error.message);
process.exit(1);
}
// Show help if requested
if (options.help) {
console.log(`
š GitLify - Git Uncommitted Changes Analyzer
Usage:
npx gitlify [options]
Options:
-v, --verbose Show detailed output with line numbers
-j, --json Output in JSON format
-f, --files Show only file list
-s, --summary Show only summary
-h, --help Show this help message
Examples:
npx gitlify
npx gitlify --verbose
npx gitlify --json
npx gitlify --files
npx gitlify --summary
`);
process.exit(0);
}
// Run the analyzer
async function main() {
try {
const analyzer = new GitLify();
await analyzer.analyze(options);
} catch (error) {
ErrorHandler.handle(error);
process.exit(1);
}
}
main();