Code Monkey home page Code Monkey logo

cookie's People

Contributors

bbugyi200 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cookie's Issues

Add support for Mac OS

[/tmp]$ cookie -l
dirname: illegal option -- l
usage: dirname path
basename: illegal option -- l
usage: basename string [suffix]
       basename [-a] [-s suffix] string [...]
[ERROR] Template does not exist: /Users/xxx/.cookiecutters/d,c,D:,e:,f,F:,h,l,m:,r:,v,x

any command gives this ^

Variable is always quoted

So basically,. it seems that the variable substitution is always adding quotes, whether they are needed or allowed in the resulting config file or not. That's not ideal.

The template

.cookiecutter/template.yml
--- # yaml file, that does not need quotes around variables
    variable: {{ VARIABLE }}

The input

cookie -T template.yml -f my.yml
>>> Found matching template: template.yml
>>> Initializing the '/root/my.yml' script.
VARIABLE: typed_input

The output

--- # yaml file, that does not need quotes around variables
    variable: "typed_input"

Add '--template-dir' option

The corresponding short-option could be -T. This option would accept a mandatory argument which must be a sub-directory of the configured cookie template directory. This option can be used in one of two ways:

  1. To specify that the entire directory should be mirrored. Example:
cookie -T mydir

would prompt the user for a project_name and then create a new directory named project_name which mirrors mydir. Next, each file in the new directory would be processed by cookie's template rendering engine and opened in an editor (one at a time).

  1. To specify that every template is relative to that directory. Example:
cookie -T mydir template:target

would initialize target using the template mydir/template.

Spaces in variables produce errors.

I was testing out cookie to see what I could do with it and after a few tests I accidentally left a variable name with spaces which caused a bad substitution error.
'''

Initializing the './/doc.sh' script.
DATE:
/home/magpie/.local/bin/cookie: line 384: ${{Script Name}}: bad substitution
{{Script Name}}:
'''

This is in Ubuntu 19.04, bash 5.0.3, and current master for cookie.
While it's not unusual for variables to require no spaces it'd be good to have a failsafe in place.

Allow installation without sudo

This is a great tool but having to use sudo make it non-usable in controlled environments, if this could be run from a clone directory that would be phenomenal

Use '@template[:[target][:mode]]' syntax to mark that a file should NOT be opened for editing

For example, cookie tempA:dirA/targA @tempB:targB:modeB tempC will:

  • Create dirA if it does not already exist.
  • Initialize dirA/targA using the tempA template.
  • Initialize targB using the tempB template.
  • Set the file mode of targB to modeB (using chmod).
  • Initialize tempC using the same name for the template and target.
  • Open ONLY dirA/targA and tempC (the target version) in an editor.

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.