Coder Social home page Coder Social logo

thaum's Issues

List templates available

Thaum should be able to list template names instead of requiring the user to simply look in their thaum_files folder.

I'm not sure what the command should be for this, thoughts?

Uppercase and lowercase naming

We could include in the template a {{titleCase name}} and {{lowerCase name}} which would be the uppercase'd and lowercase'd version of the name.

For example:

"evan" -> {{lowerCase name}} -> "evan"
"Evan" -> {{lowerCase name}} -> "evan"
"Evan" -> {{titleCase name}} -> "Evan"
"evan" -> {{titleCase name}} -> "Evan" 

We should use the same format as plop does so users who feel like they need more functionality can switch over to Plop easily. We shouldn't trap anyone into using thaum.

Create an "Undo" feature

If users enter in the wrong template or they use the command in the wrong place, it may be nice to have an "undo" command by typing:

$ thaum -u

This could be implemented by writing to a temporary file. (afero) has a function for this. In that file, you could store a checksum and the path of each file that you created.

Then, when the user calls thaum -u, you check to see if there is a temporary file and you match the checksums of each file against the ones stored. That way we don't remove files that people have edited.

Convert tests to testify

I can't see a whole lot of a reason to use goblin for testing. It adds a lot of boilerplate code. Which probably shouldn't exist in a project that's whole purpose is to remove boilerplate code.

These can be removed by testing with testify.

Include more than just "name" variables

But it would be nice to have the ability to have more than just the name variable in the template.

So:

import "{{package}}"

class {{name}} {
  //things 
  foo({{myVariable}});
}

This could be done by checking the template for {{variables}}'s and then displaying them to the user to fill in in an output.

So the "thaum" UX could be updated to show:

$ thaum myTemplate
๐Ÿ”  Using thaum_files at: "/Users/Flaque/myProject/thaum_files"

    name       : <User has entered content here> 
    package    : <User is prompted to enter content here> 
    myVariable : <User will be prompted for this after they complete the previous> 

Pros

  • Requires 0 config files or complicated scripting (which is thaum's main reason for existing)
  • Subtly reminds the user which template by listing the variables.
  • Easy to use without needing to read docs.

Cons

  • Makes thaum a little more difficult to be used in conjunction with other scripts.
    • I'm personally okay with this as I don't see thaum as a tool that would be used like that. There are many other tools for generation in scripts out there and that's not really thaum's purpose.

Make all path generations atomic

Currently if thaum finds an error in the middle of creating a bunch of files, it will stop. This means that you can get half-completed templates, which is probably not good.

This can be fixed by having the compile function in the template create a struct of paths to be created and then create them all at the end.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.