Skip to content

Instantly share code, notes, and snippets.

@varjmes
Created March 30, 2019 11:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save varjmes/803ecf84702ef02da06ca06ec01a1c13 to your computer and use it in GitHub Desktop.
Save varjmes/803ecf84702ef02da06ca06ec01a1c13 to your computer and use it in GitHub Desktop.
initialising a vrs (git) repository with ref and object directories
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