Skip to main content

devi is a cli tool for managing your project templates

Project description

devi

devi is a cli tool for managing your project templates

With devi you can create, use, reuse and manage your project templates.

Usage

devi <command> [options]

Available commands:

  • add - Add a new template to your list
  • create - Create a new project from a template
  • list - List available templates
  • rm - remove a template

$DEVI_TEMPLATES is the special directory where devi stores your templates. By default is set to ~/.templates, but it is customizable to easy migrate your existing templates!


Commands

Add a new template

The add command adds a new template to $DEVI_TEMPLATES.

devi add <path> [<template_name>]
devi add . my_new_template

# if template_name is not provided, devi will use the directory name
devi add ~/dev/my_template

Create a new project from a template

The create command creates a new project from an existing template.

devi create <template_name> [<destination>] [--name=<project-name>]

# or with syntactic sugar:
devi create <template_name> as <project_name> in <destination>
# this will create a new dir called "my_template"
devi create my_template .
# don't worry, you can give it a name
devi create my_template . --name=my_project
# equivalent to the following:
devi create my_template as my_project in .

Do you want more customization? we catch you!

Both parameters (project-name and destination) are optional. If not set, devi will use the values defined in the template.devi.toml (see template config).

Viewing and removing your templates

To see the list of available templates, run devi list. They are located on $DEVI_TEMPLATES.

Don't want a template anymore? Remove it with

devi rm <template-name> [-y]

It will ask you to confirm the deletion, you can skip this with the -y flag.

Devi's templates

$DEVI_TEMPLATES is special, the place where devi finds and stores all your templates. By default is set to ~/.templates or %USERPROFILE%\templates on Windows.

If you already have a templates folder or you want to make your templates more accesible, you can override it, e.g, for bash:

echo "export DEVI_TEMPLATES=~/my/templates" >> ~/.bashrc

TODO: configuration file for devi is not ready yet

Template configuration file

The template.devi.toml file is used to customize the template. It is autocreated by devi. Here is an example of a template for web projects:

description = 'my template for web projects'
default_name = 'new-project'
destination = '~/projects/web'
oncreate = 'npm init -y && npm install vite && npm run dev'
change_dir = true
  • description - it will be shown on devi list (default: None).
  • default_name - devi will use this name as default for devi create (default: the template's name).
  • destination - the destination directory where the project will be created in (default: ".").
  • oncreate - a shell command that will be executed after the project has been created. Commands will be relative to the newly created template (default: None).
  • change_dir - wheter you want to change your directory to the newly created template or not (default: true)

After oncreate finishes its execution, all the files and directories with the *.devi.* extension will be removed from the project. e.g.: whatever.devi.sh, my_dir.devi/, and the template.devi.toml itself.

Note Currently change_dir is not implemented for Windows (see TODO.md)

Installation

devi is distributed as a pypi package which exposes the devi binary.

pip install devi-cli

However, since devi is just a cli tool, is preferable to install it using pipx, which will create a separate python environment that won't interfere with your system's one.

pipx install devi-cli

If you don't have pipx already, go here, it's very handy! This will also avoid possible environment errors on most linux distributions.

Development

Requires python >= 3.7.

# In the root project, install an editable version of devi
pip install -e .
# Or just invoque the __main__
alias devi="python3 devi"

Project details


Download files

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

Source Distribution

devi-cli-0.2.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

devi_cli-0.2.1-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file devi-cli-0.2.1.tar.gz.

File metadata

  • Download URL: devi-cli-0.2.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for devi-cli-0.2.1.tar.gz
Algorithm Hash digest
SHA256 588c9db0e2ea857932ab41aeaa0d8a1dc779fff2f5b2f37eaa125874d928d962
MD5 430c826a343d7c98007bbf8e25f8fc1a
BLAKE2b-256 eef514f97b71a3c6e1e27a5d7525efd5ae93a8af8b6c5cf4e5e3b4f10ec6b01f

See more details on using hashes here.

File details

Details for the file devi_cli-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: devi_cli-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for devi_cli-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 902bb87b0498d06fe29d226ffd1c8f98ea02e4005b45d2092998517941688bae
MD5 d4d4fbc28017d6b2af90fa873d9520bd
BLAKE2b-256 f37727790430fd2c2839210cbe5be05355541d24a5418c8342c9313ef6bd633f

See more details on using hashes here.

Supported by

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