Skip to main content

this is a description

Project description

image-20210312140113821

Simple yet powerful code generator. Make use of existing tool as possiable as we can.

Compare to hygen, yo.

  • yo is way too slow and complicated.
  • hygen pollutes all template files, and only support ejs.

What I only need:

  1. template is runable as normal prj. No more $placehold$ stuff.
  2. instinct command with the power of fzf.
  3. quick project to template and vice versa.
  4. respect .gitignore.
  5. support github.com repo.
  6. plugin in any language only if you can run it in shell.
  7. support regrex replacement! see --help

install

pip3 install coge

usage

export COGE_TMPLS="<your_template_folder>"

1

coge js react oldkey:newkey :newkey0 :newkey1 @:destname 

What coge does:

  • copy $COGE_TMPLS/js/react to $PWD/destname
  • change all names from oldkey to newkey, from COGE_ARG_0 to newkey0 ,from COGE_ARG_1 to newkey1

2

coge js react

What coge does:

  • Just copy $COGE_TMPLS/js/react to $PWD/app

work with fzf

cg () {
	eval `coge -c $@ | fzf --preview= --bind 'enter:execute-silent(pbcopy <<< {})+abort' ` && pbpaste
}

call cg from terminal. and paste it.

timing script

you can put .coge.after.copy.sh in you template folder.

It will execute after copy, which is very handy.

For Safety reason. Template from network would need to use -s option to enforcing script executing, only if you know the script is safe.

Supported timing and language:

.coge.after.copy.sh
.coge.before.copy.sh

.coge.after.copy.py
.coge.before.copy.py

Ex: .coge.after.copy.sh

#!/bin/bash
git init 
git flow init

help

usage: coge [-h] [-a ARG_PREFIX] [-l] [-c] [-r] [-w] [-s] [-d DEPTH]
            [magic [magic ...]]

       make template link : cd x-engine-module-template && coge -r 
             use template : coge x-engine-module-template xxxx:camera @:x-engine-module-camera  
use git template from net : coge https://www.github.com/vitejs/vite \\bvite\\b:your_vite @:your_vite  


positional arguments:
  magic                  newkey:oldkey or @:folder_name

optional arguments:
  -h, --help            show this help message and exit
  -a ARG_PREFIX, --arg_prefix ARG_PREFIX
                        ex: COGE_ARG_
  -l, --list            list folders
  -c, --cmd             cmd
  -r, --link_tplt       link `cwd` to $COGE_TMPLS
  -w, --allow_git_dirty
                        alllow git dirty
  -s, --script_from_net
                        alllow script from net
  -d DEPTH, --depth DEPTH
                        list depth

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

coge-0.0.28-py2.py3-none-any.whl (7.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file coge-0.0.28-py2.py3-none-any.whl.

File metadata

  • Download URL: coge-0.0.28-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for coge-0.0.28-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 103059a4abc5c63e1345de951f24996965d91d9327b9be3a0ffb2019f78a845c
MD5 e8b95c1fba6db84199c7a84c3afebb08
BLAKE2b-256 37aadc554a1288e0145d12354ad903f60ec2abc314a0f5a1ea3265a148092b55

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page