GithubHelp home page GithubHelp logo

zouch's Introduction

zouch

Create a new file from a template.

Inspired by touch-alt and touch_erb.

Usage

NAME:
   zouch - Create a new file from a template

USAGE:
   zouch [files...]
   zouch --list
   zouch --preview [files...]
   zouch --add     [files...]

GLOBAL OPTIONS:
   --list, -l     list template files (default: false)
   --preview, -p  show template preview (default: false)
   --add, -A      add [files...] as new templates (default: false)
   -r             create directories as required (default: false)
   --force, -f    force update existing files (default: false)
   --verbose, -V  display verbose output (default: false)
   --help, -h     show help (default: false)
   --version, -v  print the version (default: false)

Examples

$ cat ~/.config/zouch/templates/today.txt
Today is {{ Now.Format "2006-01-02" }}!

$ zouch today.txt

$ cat today.txt
Today is 2021-05-02!

Variables

name type e.g.
.Filename string today.txt
.Filepath string full path of .Filename
.TemplateFilename string ~/.config/zouch/templates/today.txt
.TemplateFilepath string same as .TemplateFilename

Functions

name signature implementation
Now func() time.Time time.Now
Base func(string) string path.Base
Ext func(string) string path.Ext
Dir func(string) string path.Dir
Abs func(string) (string, error) filepath.Abs
Getwd func(string) (string, error) os.Getwd
Getenv func(string) string os.Getenv
HasPrefix func(string) bool strings.HasPrefix
HasSuffix func(string) bool strings.HasSuffix
TrimPrefix func(string, string) string strings.TrimPrefix
TrimSuffix func(string, string) string strings.TrimSuffix
LowerCamelCase func(string) string strcase.LowerCamelCase
UpperCamelCase func(string) string strcase.UpperCamelCase
SnakeCase func(string) string strcase.SnakeCase
UpperSnakeCase func(string) string strcase.UpperSnakeCase
KebabCase func(string) string strcase.KebabCase
UpperKebabCase func(string) string strcase.UpperKebabCase
Replace func(string, string, string, int) string strings.Replace
ReplaceAll func(string, string, string) string strings.ReplaceAll
Shell func(command string) (string, error) exec.Command("/bin/sh", "-c", command).Output()
RegexReplaceAll func(src string, pattern string, replace string) (string, error) regexp.Compile(pattern).ReplaceAllString(src, replace)

Installation

From source

$ go get -u github.com/Ryooooooga/zouch

From precompiled binary

https://github.com/Ryooooooga/zouch/releases/

Using zinit

Add the following to your .zshrc.

zinit ice lucid wait"0" as"program" from"gh-r" \
    pick"zouch*/zouch"
zinit light 'Ryooooooga/zouch'

Using Homebrew

$ brew install ryooooooga/tap/zouch

zouch's People

Contributors

ryooooooga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.