Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattsturgeon/embedpy
A simple script to embed files in C/C++ or create hexdump
https://github.com/mattsturgeon/embedpy
Last synced: 16 days ago
JSON representation
A simple script to embed files in C/C++ or create hexdump
- Host: GitHub
- URL: https://github.com/mattsturgeon/embedpy
- Owner: MattSturgeon
- License: mit
- Created: 2016-06-28T16:18:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-06-29T21:49:59.000Z (over 8 years ago)
- Last Synced: 2024-11-07T00:48:02.248Z (2 months ago)
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# embed.py
This python script is inspired by `xxd` and `hexdump`.
It provides a simple, cross platform way to print multiple files to an output file as a hexdump or a C header file.
## Usage
- First you want to either change directory to the same location as `embed.py`, or add `embed.py` to a location on your `$PATH` environment variable.
- Second, decide what to call your output file
- Third decide what files to include in the output
- Finally run the command:
- **Note:** The `...` is **not** part of the command, and the `${files}` should be **replaced** with real file names!
```bash
# To generate a normal dump
embed.py -o ${out_file} ${in_file_1} ${in_file_2} ${in_file_3} ${in_file_4} ...# To generate a C header file
embed.py -c -o ${out_file} ${in_file_1} ${in_file_2} ${in_file_3} ${in_file_4} ...
```- From windows you can instead **replace "`embed.py`" with "`embed.bat`"**:
- Or run using python like `python embedpy ...`
```dos
:: To generate a normal dump
embed.py -o %out_file% %in_file_1% %in_file_2% %in_file_3% %in_file_4% ...:: To generate a C header file
embed.py -c -o %out_file% %in_file_1% %in_file_2% %in_file_3% %in_file_4% ...
```## Help!
The full help can be accessed with the `-h` or `--help` switch:
```bash
python embed.py --help
```
```
usage: embed.py [-h] [-o [file]] [-a] [-c] [-n] [-l N] [-s style] [-v]
file [file ...]Creates a C file from the contents of each file.
Files are embedded as variables named afer the file name.positional arguments:
file A file to be embeddedoptional arguments:
-h, --help show this help message and exit
-o [file], --out [file]
The name of the file to output into. (default:
out.dump)
-a, --apend Append into OutputFile (default: overrite origional)
-c, --out-c Generate a C file embedding as C strings. (changes
default -o to out.h)
-n, --no-comment Disables outputting readable line comments at the end
of each row (default: false)
-l N, --length N The number of bytes to write per line. (default: 10)
-s style, --style style
Apply style to generated variable names. You may use
the most significant parts (e.g. 'u', 'up' or 'upper')
(default: no) Choices: uppercase, lowercase,
capitalize, no)
-v, --version show program's version number and exit```