Created
March 30, 2019 11:04
-
-
Save varjmes/803ecf84702ef02da06ca06ec01a1c13 to your computer and use it in GitHub Desktop.
initialising a vrs (git) repository with ref and object directories
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
const fs = require('fs') | |
const path = require('path') | |
const directories = ['objects', 'refs'] | |
const command = process.argv[2] | |
switch (command) { | |
case 'init': | |
const repoPath = process.argv[3] || '' | |
const gitPath = path.resolve(repoPath, '.git') | |
directories.map(dir => { | |
const dirPath = path.join(gitPath, dir) | |
fs.mkdirSync(dirPath, { recursive: true }) | |
}) | |
console.info(`Initialised empty vrs repository in ${gitPath}`) | |
process.exit(0) | |
default: | |
console.error(`vrs: '${command}' is not a valid vrs command`) | |
process.exit(1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment