npat-efault/picocom

Changeable default options aka config file

stefanct opened this issue · 7 comments

I've been using picocom as first choice when dealing with serial ports of all sorts for years because it makes the most commonly needed things possible with little effort. I was quite surprised that there does not seem to be a way to change the defaults (without recompilation). For example, it would be very convenient for me to change the default baud rate to 115200. I would have expected that picocom reads in a config file like ~/.config/picocom containing settings that overwrite the default options (but get overwritten by command line options). However, this apparently does not exist...?

i think this would be very useful too :(

The intended way to alter defaults is using aliases, see 8707801 . I think this makes sense for a tool which wants to be pico. It should be mentioned in the docs, though. I'll add such a paragraph unless someone beats me to it.

That's nice as an option but is inferior to a dedicated config file. There is good reason that many applications use that IMHO.
For example, updates to aliases aren't picked up immediately and easily lead to intermittent errors when changes are not propagated to all respective shells. Also, they depend on the respective shell and thus might not be available in all circumstances.
Would you be willing to accept pull requests (not that I would have the time to do that myself... :)?

Another option is scripts, which I prefer over aliases. I typically create a shell script for each different config that I end up using often.

I'd accept a pull request if the implementation was simple, robust, and optional (i.e. can be compiled out). I'd suggest a textfile containing command-line parameters, but other simple solutions may be fine, too. That being said, I also won't implement it because I need my custom built version anyhow. Thanks for the feedback, though!

I added some documentation now: wsakernel@95accb0

I think command substitutions are also a nice solution. See this pull request from my repo: https://gitlab.com/wsakernel/picocom/-/merge_requests/10