https://github.com/gjjvdburg/new.py
A simple utility to create files and folders based on templates
https://github.com/gjjvdburg/new.py
python-script template template-project
Last synced: 8 days ago
JSON representation
A simple utility to create files and folders based on templates
- Host: GitHub
- URL: https://github.com/gjjvdburg/new.py
- Owner: GjjvdBurg
- License: gpl-3.0
- Created: 2016-10-24T18:13:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-12T21:13:48.000Z (over 5 years ago)
- Last Synced: 2025-01-03T17:47:45.051Z (over 1 year ago)
- Topics: python-script, template, template-project
- Language: Python
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
new.py
======
*A simple utility to create files and folders based on templates*
With this program you can define template files, for instance a Python script
with some documentation or functions already defined, or a directory for a
LaTeX document. See the example directory for an example of a Python script.
Usage
-----
Usage is quite simple, type::
./new.py
on the command line to get an overview of the current templates, and their
names. Templates should be stored in the home directory, in the directory
`${HOME}/.newpy_templates`. If you have for instance a Python script with the
name `python.py` as template name, you will get::
./new.py
Available targets:
Name File / Dir
---- ----------
python -> python.py
With the target name `python`, you can use the following command to copy the
template to the current directory::
./new.py python
This will create a new file in the current directory named `python.py`.
Finally, there is the option of naming the file in the current directory
differently::
./new.py python myscript.py
This will create the file `myscript.py`, as a copy of the `python.py`
template.
Installation
------------
Simply download the script, create a template or two, and start using it! For
added usability, you can create an alias in your `~/.bashrc` file, for
instance:
alias new="/path/to/new.py"
Then you can simply type `new ` in your terminal.
Bash Completion
---------------
If desired bash completion can be configured for the ``new`` command. This
assumes that you have aliased ``new.py`` using the description above. To
enable bash completion, add the following to your ``~/.bashrc`` file:
source /path/to/new.bash-completion
This should enable tab-completion of new.py targets.
Afterwords
----------
Author: G.J.J. van den Burg
Date: 2016-10-24
License: GPLv3