make_c
A script to generate a simple C program with a few basic includes and a main(). Then it opens the file in your editor of choice placing the cursor at the proper line and column to start adding code.
Supported editors include:
- vim
- SublimeText (
subl) - TextMate (
mate) - Visual Studio Code (
code) - nano
- emacs
Installing
$ pip3 install make-c
Running
Help output:
$ make_c --help
usage: make_c [-h] [-l] [--version] [--editor EDITOR] [--skip-editor] [-T]
[-M]
[filename]
make_c: A utility to create a simple C source file with a main and open it in
an editor. version 0.2.0
positional arguments:
filename Name of the source file to create.
options:
-h, --help show this help message and exit
-l, --list-editors List known editors.
--version Print version string and exit.
--editor EDITOR Editor to use to open the resulting source file.
--skip-editor Create the source file but don't open it in an editor.
-T, --tabs Use tabs instead of spaces.
-M, --generate-makefile
Create a makefile to build the program.
List available editors:
$ make_c --list-editors
Known editors:
vim: Vi IMproved, a programmer's text editor
subl: Sublime Text 3
mate: TextMate 2
code: Visual Studio Code
emacs: GNU project Emacs editor
nano: Nano's ANOther editor, an enhanced free Pico clone
If an editor isn't provided on the command line, it can be specified using an environment. The variables that are used are, in the following order:
MAKE_C_EDITOREDITORVISUAL
Creating and editing a file:
# Create foo.c and edit in the default editor, VIM:
$ make_c foo.c
# Edit using $MAKE_C_EDITOR environment variable to specify editor:
$ export MAKE_C_EDITOR=/usr/local/bin/emacs
$ make_c foo.c
# If MAKE_C_EDITOR isn't set, EDITOR and VISUAL respected, in that order:
$ unset MAKE_C_EDITOR
$ export EDITOR=/usr/bin/vim
#Edit in SublimeText instead:
$ make_c foo.c --editor=subl
#Generate a makefile in addition to the C file.
$ make_c foo.c --generate-makefile
Adding editor support
To add additional editors, extend the CProgram class and override:
- The
EDITORclass variable - The
DESCRIPTIONclass variable - The
generate_editor_command()instance method
The string representation for --list-editors is automatically generated by the superclass from EDITOR and DESCRIPTION.
The generate_editor_command() method should return an argv that represents that editor's commandline incantation in list form suitable for consumption by subprocess.Popen(). For example, if your editor takes a --line and --column argument, you would return:
def generate_editor_command(self):
return [self.generate_editor_arg0(),
"--line",
"%d" % self.edit_line,
"--column",
"%d" % self.edit_column,
self.filename]
Metadata
Release files for make-c 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| make_c-0.2.0.tar.gz | 6.3 kB | Without provenance | Details for make_c-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| make_c-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for make_c-0.2.0-py3-none-any.whl |
Total release size: 14.1 kB
Release files / make_c-0.2.0.tar.gz
| Download URL | make_c-0.2.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd993dcb360ef43fe89cfae000cf82a9fbe3c61ea946f107fc21a1f3782acc9c
|
|
BLAKE2b-256 checksum How to use checksums |
07df6499970eccae7b30f3c25221ad81a88e2a0e952965a10f3ee0b559463748
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.1
|
Release files / make_c-0.2.0-py3-none-any.whl
| Download URL | make_c-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7ea2fec58d70ac3b46c6d6c82e7856aa42f059e732bebcfd957eb462b778840
|
|
BLAKE2b-256 checksum How to use checksums |
c97813276e6209ef01cdb354091be31c9420f344379d7b42cfdd649a771de14f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.1
|
Security for make-c 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.