Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rudifa/newcpp
CLI utility creates a new C++ project
https://github.com/rudifa/newcpp
Last synced: 7 days ago
JSON representation
CLI utility creates a new C++ project
- Host: GitHub
- URL: https://github.com/rudifa/newcpp
- Owner: rudifa
- License: mit
- Created: 2024-12-20T12:18:47.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-02-01T16:27:55.000Z (20 days ago)
- Last Synced: 2025-02-01T17:27:00.172Z (20 days ago)
- Language: C++
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# newcpp
`newcpp` is a command line tool to create a new C++ project.
It creates a new directory with the given project name and initializes a git repository. It also creates a `README.md` file with the project name and a `main.cpp` file with a simple hello world program.
## usage
```sh
% newcpp
Usage: newcpp
``````sh
newcpp % newcpp project-1
Initialized empty Git repository project-1/.git/
[main (root-commit) cf1f0eb] Initial commit
3 files changed, 32 insertions(+)
create mode 100644 .gitignore
create mode 100644 README.md
create mode 100644 main.cpp
Created new C++ project 'project-1'
cd into 'project-1' to get started
§
```## details
This implementation:
- Uses modern C++ features like the filesystem library
- Creates the project directory
- Creates README.md with basic project information
- Creates a simple main.cpp with a "Hello, World!" program
- Creates a .gitignore file with common C++ ignores
- Creeates a CMAkeLists.txt with basic configuration
- Initializes a git repository and makes an initial commit
- Includes basic error handling
- Uses system() for git operations (note: this is a simple approach; for a more robust solution, you might want to use libgit2 or similar)The program checks for:
- Correct number of command line arguments
- Directory existence
- File operation errorsYou could extend this by:
- Adding command line options for different project templates
- Creating more sophisticated project structures
- Adding license file generation
- Adding dependency management setup
- Using a proper git library instead of system() calls
- Adding more error handling and validation