Bluehawk icon indicating copy to clipboard operation
Bluehawk copied to clipboard

Customize filename extension

Open lilisha-unity opened this issue 2 years ago • 3 comments

Tried it today and it worked great! However, I would like to be able to customize the file name and file extension, such as: bluehawk snip -o path/to/my-customized-filename.md <input-directory-or-file>

lilisha-unity avatar May 25 '22 16:05 lilisha-unity

thank you for submitting the issue! we're adding to our roadmap.

i think the API would be something like:

bluehawk snip -o path/to/output_dir input-file.foo --ext bar 

and this'd create output-file.bar

mongodben avatar May 25 '22 17:05 mongodben

Thanks for raising @lilisha-unity! Can you tell us about how this will be used?

  • Expected behavior if input-directory contains multiple files? i.e. should the custom name be a template (instead of <sourcefile>.<snippetname>.snippet.<sourceextension>)? Or just a literal name that we write to?
  • Any assumptions about custom extension? For example, is ".md" expected to produce valid markdown or just whatever language while the file has md extension?

Thanks!

cbush avatar May 25 '22 17:05 cbush

@mongodben to add an ext flag, see here:

  • Add option to CLI: https://github.com/mongodb-university/Bluehawk/blob/main/src/cli/commandModules/snip.ts#L17
  • Add option to action args: https://github.com/mongodb-university/Bluehawk/blob/main/src/bluehawk/actions/snip.ts#L11
  • Apply extension: https://github.com/mongodb-university/Bluehawk/blob/main/src/bluehawk/actions/snip.ts#L190

cbush avatar May 26 '22 20:05 cbush