Stored commands
jayvdb opened this issue · comments
In packaging .spec files, there are a few very common tasks which are normally done with sed/awk/etc.
Most could be expressed as a bsed command which would be nice.
e.g. equiv of dos2unix, removing hashbang, replacing hashbangs.
i.e. https://python-rpm-porting.readthedocs.io/en/latest/applications.html#fixing-shebangs really recommends people write those commands. Surely we can do better than that before 2020 lands ;-)
Packaging python has a few others like replace == with >= inside setup.py strings.
It would be useful if these could be stored commands somehow.
they could be scripts which use bsed as their interpreter, or named aliases like 'bsed run foo', with details in a config.
Are you suggesting creating a way for a user to store their own personally-used commands?
Or adding these commands to the core syntax?
If you mean the first, can you explain why this would be preferable to modifying one's bash_profile (or the equivalent for their environment)?
Actually, neither of those.
I was hoping to have shared groups of commands.
e.g. /usr/share/bsed/aliases/rpmbuild.ini
might contain
dos2unix = ...
fix_hashbang = ...
remove_hashbang = ...
Then that command list could be put into a package , which would be installed into the rpmbuild environment, or installed by packagers locally for debugging, and used something like bsed --run-stored fix_hashbag foo.py
The reason for having multiple alias files is to allow different rpms to 'own' different sets of alias files, to prevent conflicts in rpm packaging.