Giter Club home page Giter Club logo

dahl's Introduction

Dahl Logo

A Simple CLI made with Cobra package for generating files.

GitHub go.mod Go version Go Report Card GitHub Workflow Status Package License GitHub repo size GitHub Tag GitHub Releases

Sponsors

Maintainence of this project is made possible by all the contributors and sponsors. If you'd like to sponsor this project and have your avatar or company logo appear below click here. ๐Ÿ’™

Overview

Hello fellow developer!

Welcome to the Dahl repository! Dahl is a command line tool that helps developers create and use custom templates to generate files quickly and easily. With Dahl, you can save time and effort by using pre-defined templates to generate the files you need for your project, rather than starting from scratch every time.

This repository contains the source code for Dahl, as well as documentation and examples to help you get started. You can also share your own templates with the community by contributing to the repository.

Whether you're a seasoned developer or just starting out, Dahl is a valuable tool to have in your arsenal. Give it a try and see how it can streamline your workflow and save you time.

Thank you for checking out Dahl. We hope it becomes a valuable addition to your toolkit.

Getting Started

Installation

Binary Release (Linux/OSX/Windows)

You can manually download a binary release from the release page.

Automated install/update, don't forget to always verify what you're piping into bash:

curl https://raw.githubusercontent.com/Spacelocust/dahl/main/scripts/install.sh | bash

The script installs downloaded binary to $HOME/.local/bin directory by default, but it can be changed by setting DIR environment variable.

I already made an alias for zsh if you want:

echo "alias dahl='~/.local/bin/dahl'" >> ~/.zshrc

(you can substitute .zshrc for whatever rc file you're using)

Go

Required Go Version >= 1.16

go install github.com/Spacelocust/dahl@latest

Required Go version >= 1.8, <= 1.17

go get github.com/Spacelocust/dahl

Docker

Docker Pulls Docker Stars Docker Automated Docker Image Version (latest semver)

docker run --rm -it -v /your/project/path:/app -w /app spacelocust/dahl:latest

Usage

In your root project, use the following commande for generating a dahl-config.yml and .dahl directory

dahl init

Use hello-world flag if you want a example template and configuration

dahl init --hello-world

The dahl-config.yml will grouping all of your template configuration

## dahl-config.yml
templates:

  ## list template
  [template name]:
    to: # destination path of generating file
    from: # location path of template file
    filename: # filename of generating file
    prefix: # prefix filename
    suffix: # suffix filename
    
    ## list props (custom keys)
    props:
      [prop name]:

Commands

## base command
dahl [command] [template] [flags]

You can use flags to overwrite some value from the config file, like filename, destination...

Flags:
    -n, --filename   (string)
    --from           (string)  
    --to             (string)
    --props          (json)
    -p, --prefix     (string)
    -s, --suffix     (string)
    -e, --extension  (string)
    -f, --force
    -y, --yes

"Filename, From, To" value are required, you must specify them with the cli or config file.

Info: the config file isn't required, you can use templating with the cli this way:

dahl run 
  --from /my/template/path 
  --to /my/destination/path
  --filename my-file

Template

pattern description
_{ value }_ related to file keys
_{ @value }_ custom props keys

Examples

dahl run express-controller -n User
## dahl-config.yml
templates:

  express-controller:
    to: "./src/controller"
    from: "/express/controller/my-controller.dahl"
    extension: ".js"
    props:
      http:
        status: 
          ok: 200
// my-controller.dahl

export const get_{ filename }_ = (req, res) => {
  // stuff
  return res.status(_{ @http.status.ok }_).send()
}

export const update_{ filename }_ = (req, res) => {
  // stuff
  return res.status(_{ @http.status.ok }_).send()
}

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

There is still a lot of work to go! Please check out the contributing guide. For contributor discussion about things not better discussed here in the repo, join the discord channel

Support

Reach out to the maintainer at one of the following places:

License

This project is licensed under the MIT license.

See LICENSE for more information.

Acknowledgements

dahl's People

Contributors

spacelocust avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.