Git Product home page Git Product logo

cloup's Introduction

cloup

Downloads License

cloup is a template manager that delivers the files you desire when you need them, written in rust

you no longer need to locate your previous project and copy and paste files over

How it worksInstallation

Example image

Motivation

I always find myself having to go search for certain files or folders, usually config setups, that are the same across every project. These could be virtually anything, but for me it's usually .prettierrc, .eslintrc, tsconfig.json, tests/, etc.

The idea is to be able to retrieve these files at the speed of light in any project I need them. So.. instead of locating an old project and copying the files to then paste in the new project, I wanted a way to save them as templates and be able to apply them into the current directory with a command, but also to be able to create my own version of base templates with already-configured settings.

No longer do you need to use the same create-app-* and then change it to your liking. Run it once, create a base template that you like, and use cloup apply <your-template-name> and it inserts all the folders and files recursively into the current directory.

How it works

Say you have a folder with some files:

project
│   .prettierrc
│   .eslintrc
│   index.ts
│   package.json
│   tsconfig.json
└───src
    │   index.ts
    │   utils.ts
    └───folder
        │   another_file.ts
        │   ...

and you want to re-use the .prettierrc and .eslintrc for every project, you can create a cloup of those files by running the following command:

$ cloup create react-dotfiles -f .prettierrc .eslintrc

We've now created a cloup called react-dotfiles.

Now, say you create a new project:

new-project
│   index.ts
│   package.json
│   tsconfig.json

To apply the cloup in this directory, we simply run this command in the same directory:

$ cloup apply react-dotfiles

And the file tree now looks like this:

new-project
│   .prettierrc
│   .eslintrc
│   index.ts
│   package.json
│   tsconfig.json

It's that simple.

However, cloups are not limited to single files or folders. In the above examples, we used the -f flag to specify individual files and folders we wish to include in our cloup, but we can also create cloups of entire folders, with all their files recursively included.

Take this example:

project
│   .prettierrc
│   .eslintrc
│   index.ts
│   package.json
│   tsconfig.json
└───src
    │   index.ts
    │   ...
────tests
    │   ...

If we wanted this to be our "base template" for every new project we start, we can cloup the entire file by only giving the cloup a name and no extra arguments:

$ cloup create base-template

Now you can apply this cloup to any new empty folder with $ cloup apply base-template and have the entire folder structure with already-configured files and configs in moments.

Installation

Cloup is currently only available through Homebrew and Cargo. Other methods of installation are on the way!

Homebrew

$ brew tap benja/tap
$ brew install cloup

Cargo

$ cargo install cloup

Setup

After a successful install, create a new directory somewhere on your computer and run $ cloup init in that folder to initialise it as the template directory.

This is where all your cloups will be stored. Feel free to keep this folder versioned so you never lose your cloups if you switch computers.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

cloup's People

Contributors

benja avatar

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.