GithubHelp home page GithubHelp logo

cltemplate's Introduction

CLTemplate

github crates.io

Small commandline tool to create and use templates quickly

Installation

Simply run cargo install cltemplate to install the tool.

Using Templates

To use a template, do the following:

  1. CD into the folder of the template (your terminal should be running at path/to/template)
  2. Run template path/to/output and check the directory you provided

Optionally, you can use the --template-path param instead of CDing to the the template folder

Writing Templates

To write a template that others can use with this tool, you must:

  1. Create a folder for the template

  2. In the root directory of the folder, create a template.txt file. In this file, there should be the name of each replaceable item, separated by newlines (ex:

    foo
    bar
    buz
    qux
    quux
    corge
    grault
    garply
    waldo
    fred
    plugh
    xyzzy
    thud
    

    )

  3. Fill in the rest of the folder with the files provided in the template. Anything defined in template.txt that has % around it (ex: %foo%) will be replaced by whatever the user inputs. Anything surrounded by % that is not included in template.txt will remain unchanged.

  4. Share your template and usage instructions via your preferred method.

License

This tool is licensed under the MIT license.

Roadmap

cltemplate's People

Contributors

hypercodec avatar dependabot[bot] avatar

Watchers

 avatar

cltemplate's Issues

Dialoguer messages copy when wrapping

Dialoguer uses a clearline char to clear the latest line, but if the response wraps to another line, it only deletes the part that wraps instead of the full prompt.

Infinitely recursing templates

If the target directory is a subset of the template directory, the engine will keep adding folders for a long time until the exploration outperforms the async task.

Likely will be solved by entirely disabling targets inside of templates.

Mutex Poisoning

When working with a lot of files, it can break because the handles vec is being consumed before actually joining them.

Non-UTF-8 files crash during template use

Any file that does not contain valid UTF-8 will cause the following:

thread 'main' panicked at 'Unable to read file: Error { kind: InvalidData, message: "stream did not contain valid UTF-8" }',  src/main.rs:55:61
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.