Skip to main content

A command-line tool to create new projects

Project description

new-project-cli

asciicast

Description

Create a new project from the terminal.

This tool will help you create a minimal structure for your new project.

You can create new:

  • Bash projects
  • C projects
  • Cpp projects
  • Go projects
  • Java projects
  • Lua projects
  • OCaml projects
  • PHP projects
  • Python projects
  • Ruby projects
  • Rust projects
  • Vlang projects
  • Web projects (html, css, javascript)

and open them in:

Why these programming languages?

I mainly based myself on the percentages reported by Stackoverflow's 2023 Developer Survey for the "Programming, scripting, and markup languages" section, and I selected the most used languages and those that I consider to be the most promising or interesting

Default development directories tree

$HOME
└──Developer
   └── projects
       ├── bash_projects
       ├── c_projects
       ├── cpp_projects
       ├── go_projects
       ├── java_projects
       ├── lua_projects
       ├── ocaml_projects
       ├── php_projects
       ├── python_projects
       ├── ruby_projects
       ├── rust_projects
       ├── vlang_projects
       └── web_projects

Projects created via commands

E.g: To create a new Rust project, newproject use the following command:

$ cargo new project_name

So it use the default command to create a new cargo package.

The same is for Ruby, OCaml and Vlang.

Requirements

To create a Rust projects

To create a Ruby projects

To create a OCaml projects

Installation

This tool currently only works for *NIX operating systems

Easy as you can see here:

$ pip install newproject-cli

Please note: After installing newproject with pip if you have not added ~/.local/bin (MacOS/Linux) to $PATH you will be asked to do so with a warning that should look like this:

WARNING: The script newproject is installed in '/home/ubuntu/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Usage

Create a new python project

$ newproject --python project_name

Create a new web project

$ newproject --web project_name

This command will create a very simple web project with this structure:

project_name
├── README.md
├── index.html
├── scripts
│   └── index.js
└── styles
    └── style.css

Create a new project and open it in Visual Studio Code

ATTENTION: In order to open the new project in your favorite IDE you need to have the shell command

$ newproject --code --python project_name

Customization

YAML config file in ~/.config/newproject

The default configuration file is located in the site_packages folder, but you can also use a configuration file that you can create in the ~/.config/newproject folder. Let's see how you can do it:

  • Create the configuration folder and the YAML config file
$ cd ~/.config
$ mkdir newproject
$ touch newproject_config.yaml
  • Open the YAML file in your editor of choice

  • Copy the contents of this file into the YAML file

  • Done

Customize the Development folder

In ~/.config/newproject/newproject_config.yaml:

development_dir_path: path/to/your/development/folder/

E.g:

development_dir_path: Documents/projects/

Customize a programming language projects folder

In ~/.config/newproject/newproject_config.json:

project_folder_names:
  python_projects_dir_name: python_projects

Customize a programming language file content

You can customize the content of the files only of the following programming languages:

  • Bash
  • C
  • Cpp
  • Go
  • Java
  • Lua
  • PHP
  • Python
  • Web projects (html, css, javascript)
cpp:
  file_content: |
    #include <iostream>

    int main()
    {
        std::cout<<"hello world"<<'\n';
        return 0;
    }

Customize the .gitignore for a specific programming language

You can customize the content of the .gitignore only of the following programming languages:

  • Bash
  • C
  • Cpp
  • Go
  • Java
  • Lua
  • PHP
  • Python
  • Web projects (html, css, javascript)
python:
  gitignore_content: |
    DS_Store
    .env
    .vscode/
    .idea/
    test/
    venv/

Customize the default .gitignore

default_gitignore_content: |
  .DS_Store
  .env
  .vscode/
  .idea/
  test/
  foo/

Roadmap

  • Improve customization
  • Add more programming languages
  • Add more IDE
  • Improve user output and experience
  • Publish this project to package managers
  • Add Windows support

Contributing

If you would like to contribute to this project just create a pull request which I will try to review as soon as possible.

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

newproject_cli-0.2.2.tar.gz (10.9 kB view hashes)

Uploaded Source

Built Distribution

newproject_cli-0.2.2-py3-none-any.whl (10.5 kB view hashes)

Uploaded Python 3

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