Strip comments away.\ Delete comments out of text files.
Comments are helpful in configuration files, source code, shell scripts and any other text based files. But sometimes they only distract from the actual content. So with this tool you can strip away the comments of the most common formats.
Currently supported comment styles: - Shell style
Planned comment styles: - C style - XML style
I started this project to enhance my practical knowledge of the rust programming language. I could not find an easy applicable solution to the problem with detecting comments, except for some sed magic, so I decided to give it a try. If you like the tool and would like to contribute or simply leave a note, feel free to open an issue.
To compile comment-strip you need somewhat recent version of rust.
If you are using cargo, it's easy to get an executable.
1. git clone git@github.com:XOSplicer/comment-strip.git
2. cd comment-strip
3. cargo build --release
4. cargo test
(optional)
5. ./target/release/strip --help
to display usage
```
$ ./strip --help
strip 0.1.0
Felix Stegmaier stegmaier.felix@gmail.com
Strip comments away, default style is Shell comment style
USAGE: strip [FLAGS] [OPTIONS] [INPUT]
FLAGS:
-c, --c-style Strip away C style comments e.g. /* some comment */
or // some line comment
, only one style may be specified
-h, --help Prints help information
-s, --shell-style Strip away shell style comments e.g. # some line comment
, only one style may be specified
-V, --version Prints version information
-x, --xml-style Strip away XML style comments e.g. <!-- some comment -->
, only one style may be specified
OPTIONS: -o, --output
ARGS: Sets the input file to use, uses stdin if not set ```
``` $ cat ./myshellscript.sh
uname -a # display the current os
whoami pwd #and where we are
echo 'Hello, "world" #no comment' #comment
$ strip --shell-style myshellscript.sh
uname -a whoami pwd echo 'Hello, "world" #no comment'
```
This project is licensed under the MIT License - see the LICENSE file for details