| Crates.io | toggle-comment |
| lib.rs | toggle-comment |
| version | 0.5.0 |
| created_at | 2020-08-31 07:27:14.55715+00 |
| updated_at | 2020-09-28 04:16:44.137104+00 |
| description | A utility for setting or toggling the line-comment status of lines in plain text files in a do-what-i-mean fashion |
| homepage | |
| repository | https://github.com/nelfin/toggle-comment |
| max_upload_size | |
| id | 282968 |
| size | 39,444 |
toggle-comment is a utility designed around setting or toggling the line-comment status of lines in plain text files in a do-what-I-mean fashion. It aims for muscle-memory compatibility with GNU sed.
$ cat > example.py <<'EOF'
def greet(name):
# Give salutations
return f'Hello, {name}!'
print(greet('world'))
EOF
$ toggle-comment '/def/,/return/' example.py
# def greet(name):
# # Give salutations
# return f'Hello, {name}!'
print(greet('world'))
$ toggle-comment '1,3' example.py | toggle-comment '4,5!'
def greet(name):
# Give salutations
return f'Hello, {name}!'
print(greet('world'))
regex crate. Notable differences
are in the (lack of) escapes for special characters, e.g. /a|b/ vs /a\|b/M~N "step-wise" patterns, e.g. 1~3 matching lines 1, 4, 7...;addr,~N "up-to-multiple", e.g. 10,~7 matching lines 10-14; and\|http://| (initial
backslash followed by delimiter);