Skip to content

Commit

Permalink
Rename --dir option.
Browse files Browse the repository at this point in the history
  • Loading branch information
cossssmin committed Feb 23, 2020
1 parent 5a6fd51 commit 037c813
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = () => {

cli
.command('make:layout <filename>')
.option('-d, --dir <dir>', 'directory where the file should be output')
.option('-d, --directory <dir>', 'directory where the file should be output')
.description('scaffold a new Layout')
.action((filename, cmdObj) => {
if (path.parse(filename).ext === '') {
Expand All @@ -22,7 +22,7 @@ module.exports = () => {

try {
const layout = fs.readFileSync(`${__dirname}/stubs/layout.njk`, 'utf-8')
const destination = cmdObj.dir ? path.resolve(`${cmdObj.dir}/${filename}`) : path.resolve(`${process.cwd()}/src/layouts/${filename}`)
const destination = cmdObj.directory ? path.resolve(`${cmdObj.directory}/${filename}`) : path.resolve(`${process.cwd()}/src/layouts/${filename}`)

if (fs.existsSync(destination)) {
throw(`Error: ${destination} already exists.`)
Expand All @@ -37,7 +37,7 @@ module.exports = () => {

cli
.command('make:template <filename>')
.option('-d, --dir <dir>', 'directory where the file should be output')
.option('-d, --directory <dir>', 'directory where the file should be output')
.description('scaffold a new Template')
.action((filename, cmdObj) => {
if (path.parse(filename).ext === '') {
Expand All @@ -46,7 +46,7 @@ module.exports = () => {

try {
const template = fs.readFileSync(`${__dirname}/stubs/template.njk`, 'utf-8')
const destination = cmdObj.dir ? path.resolve(`${cmdObj.dir}/${filename}`) : path.resolve(`${process.cwd()}/src/templates/${filename}`)
const destination = cmdObj.directory ? path.resolve(`${cmdObj.directory}/${filename}`) : path.resolve(`${process.cwd()}/src/templates/${filename}`)

if (fs.existsSync(destination)) {
throw(`Error: ${destination} already exists.`)
Expand Down

0 comments on commit 037c813

Please sign in to comment.