/temp

A Program to create and reuse files written in Rust

Primary LanguageRust

Temp

A Program to create and reuse files written in Rust. It puts stuff learned from The Book and the CLI Recipe to practice.

Installation

tbd

Usage

Commands prepended with a ? are optional. All paths can either be absolute or relative.

Using templates

$ temp create <template-key> ?<outputpath>

$ temp create vue src/components/Slider.vue

Generates Slider.vue at ./src/components/ based on the template saved under the key vue. If you ommit the <outpath> the file will be called New.vue and create in the current directory.

Adding templates

$ temp add <template-key> <path-to-template>

$ temp add mjml src/my-mail.mjml

Adds a template saved under mjml based on the file located at src/my-mail.mjml.

Removing templates

$ temp remove <template-key> <path-to-template>

$ temp remove mjml

Removes the template saved under mjml.

Progress

  • Use Main function to examplify usage

Modularize functionality

  • Have one config object that defines actions and variables
  • Create one function to call in order to run the program
  • Keep one file that keeps track of all existing templates

Create files based on saved templates

  • Parse the commandline arguments

  • Read file to extract the correct template

  • Create a file at the appropriate location based on the chosen template

  • Change way to store templates

  • Add/Remove Templates to/from file

Add tests to keep current functionality

Additions

  • Add remote templates
  • Use a better suited format to store/access templates (e.g. json, yml ...)
  • Add more properties to templates like fileEnding or variants
  • Make it possible to create multiple templates for one template-key with one default template.
  • Add more template options e.g. defaultName
  • Add filetrees to enable templates for projects instead of just files