3 ms·
While mature and time-honored, not modern, utilities like sed and envsubst go a long way to managing any config. Making a "modern cli" application that wraps ex
by adolph 2y ago
While mature and time-honored, not modern, utilities like sed and envsubst go a long way to managing any config. Making a "modern cli" application that wraps existing functions is like giving someone a fish, as opposed to teaching them to fish with stable and ubiquitously available tools.
Create entry (using a template and exported variables):
$ envsubst < .ssh/template.config >> .ssh/config
Read entry (assuming the 4 line template):
$ sed -n /<Host entry>/,+3p .ssh/config
Update entry: Delete and Create
Delete entry (assuming the 4 line template):
$ sed -i /<Host entry>/,+3d .ssh/config