untitaker / spacemod Goto Github PK
View Code? Open in Web Editor NEWA easy to understand and powerful text search-and-replace tool
Home Page: https://untitaker.github.io/spacemod/
License: MIT License
A easy to understand and powerful text search-and-replace tool
Home Page: https://untitaker.github.io/spacemod/
License: MIT License
We have accept change to specific file (y) and accept all (A)
There should be something in-between. How about "accept this exact diff in other files too"?
Sometimes pattern-matching becomes too burdensome and I'd like to do what fastmod can do with -F
However, at the same time, this pattern-matching is supposed to be less burdensome than raw regexes.
from fastmod help:
-F, --fixed-strings
Treat REGEX as a literal string. Avoids the need to escape regex metacharacters (compare to ripgrep's option
of the same name).
should we extend our pattern-matching language to allow for different/easier ways of escaping things instead? bailing out of regexes entirely is a bit heavy-handed and inflexible
spacemod "^(\d*)" -F "a.literal.string" "(.*)" "replacestring"
would be the same as ^(\d*)a\.literal\.string(.*)
We should have a flag to interpret the string as a regular regex. I also think it should probably be the default mode to make the transition from fastmod easier.
Either that or we make changes to the parens matching syntax to make it harder to accidentally write something that works in fastmod but not in spacemod.
It would be useful to match against well-balanced XML/HTML tags, not just parenthesis. Need this for working around apktool bugs.
I sometimes hit enter too fast. It would be really cool to be able to have an undo stack. Probably requires keeping everything in RAM
I think this behavior is actually the same as in fastmod, not sure. It might bother people, I haven't run into a case yet where it'd have surprised me.
We can probably use rayon in the background to search files while the user is approving diffs. This would reduce waiting time between diffs. I think it'd be worth the extra complexity, and in order to fix some other bugs some refactoring is necessary anyway.
see also #2
There should be some option to be able to "gloss over" mismatched parenthesis when found inside of quotes. I am not quite sure how to make that happen without complicating the language.
probably quadratic over filesize
-m
for turning on multiline modeif I approve a change in file A and the next diff is from file B, undo does not work anymore
command line:
spacemod 'machine_helper.state = (.+) ; slf.reader.unread_char ( (.+) ) ; ControlToken::Continue' 'reconsume_in!($2, $1)' /tmp/lol.rs
code:
c => {
machine_helper.state = State::ScriptData;
slf.reader.unread_char(c);
ControlToken::Continue
}
}
Some("<") => {
machine_helper.state = State::ScriptDataEscapedLessThanSign;
ControlToken::Continue
}
Some("\0") => {
emitter.emit_error(Error::UnexpectedNullCharacter);
emitter.emit_string("\u{fffd}");
ControlToken::Continue
}
None => {
emitter.emit_error(Error::EofInScriptHtmlCommentLikeText);
ControlToken::Eof
}
Some(xs) => {
emitter.emit_string(xs);
ControlToken::Continue
}
}
),
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.