You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I mentioned in #9 that the absence of dynamics in the second argument causes some inconvenience.
Current situation
Currently i can't create new folder with variable name.
cliOf('Create module',module).ask({name: 'moduleName',message: 'How we name it?',type: 'input'}).move(answers=>(['./template']),`../src/modules/???`)
And I can't understand how i can rename the newly created folder after creating it with some temporary unique name. For example:
consttempHash=Date.now();cliOf('Create module',module).ask({name: 'moduleName',message: 'How we name it?',type: 'input'}).move(answers=>(['./template']),`../src/modules/${tempHash}`).rename(`../src/modules/${tempHash}`,(answers)=>{// how I can rename folder, instead file name?})
I think a simpler api that will cover most of the use cases will look something like this
Just copy with renaming:
cliOf('Create module',module).copy('./templates/module/index.ts','./src/NewModule/main.ts')/* result:ls ./src/NewModule/ ⇐ (NewModule folder is being created if not exist before that)main.ts*/
cliOf('Create module',module).ask({name: 'type',message: 'What type of it?',type: 'input'}).ask({name: 'name',message: 'How we name it?',type: 'input'}).copy(answers=>([`./templates/${answers.type}/*.ts`,`./src/${answers.name}/`))/* result:ls ./src/myAwesomeModule/index.tsutils.tssome.ts*/
Copy in place (Optional - just for consistent)
cliOf('Clone module',module).copy(`./src/module/`)/* ls ./src/module_copy/ index.ts utils.ts some.ts*/.copy(`./src/module/*`)/* ls ./src/module/ index.ts index_copy.ts utils.ts utils_copy.ts some.ts some_copy.ts*/.copy(`./src/module/some.ts*`)/* ls ./src/module/ index.ts index_copy.ts utils.ts utils_copy.ts some.ts some_copy.ts some_copy_copy.ts*/
The text was updated successfully, but these errors were encountered:
Akiyamka
changed the title
move method accept answers only in first arg
.move method accept answers only in first arg
Feb 18, 2020
I mentioned in #9 that the absence of dynamics in the second argument causes some inconvenience.
Current situation
Currently i can't create new folder with variable name.
And I can't understand how i can rename the newly created folder after creating it with some temporary unique name. For example:
Workaround (work only for unix systems⚠️ ):
Proposed api:
I think a simpler api that will cover most of the use cases will look something like this
Just copy with renaming:
Copy by mask:
Copy files using answers (in both arguments):
Copy in place (Optional - just for consistent)
The text was updated successfully, but these errors were encountered: