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:
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
$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
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.
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.
$ newproject --python project_name
$ 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
WARNING: In order to open the new project in your favorite IDE you need to have the shell command
$ newproject --code --python project_name
The default yaml config file is located in site_packages
$ pip3 show newproject-cli
Name: newproject-cli
Version: 0.x.x
Summary: A command-line tool to create new projects
Home-page: https://github.com/utox39/new-project-cli
Author: utox39
Author-email: francescomoccaldi39@gmail.com
License: MIT
Location: path/to/site-packages <-- LOOK HERE
Requires: jsonschema, pyyaml, rich, typer, typing_extensions
Required-by:
$ cd path/to/site-packages/newproject/config
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.
ATTENTION: Using this config file does not involve updating to the latest features involving the default config file (located in the site_packages), therefore it requires manual intervention
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
In newproject_config.yaml:
development_dir_path: path/to/your/development/folder/
E.g:
development_dir_path: Documents/projects/
In newproject_config.yaml:
project_folder_names:
python_projects_dir_name: python_projects
In newproject_config.yaml:
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;
}
In newproject_config.yaml:
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/
default_gitignore_content: |
.DS_Store
.env
.vscode/
.idea/
test/
foo/
- Improve customization
- Add more programming languages
- Add more IDE
- Improve user output and experience
- Publish this project to package managers
If you would like to contribute to this project just create a pull request which I will try to review as soon as possible.