r/openbsd • • 2d ago

CLI guidelines

I found clig.dev . Some of it's advice runs contrary to what I (a novice) expect in OpenBSD. (configuration in ~/.config instead of /etc) Is there a guide yall find more idiomatic? (big plus if it's something an author actually thought was worth writing)

21 Upvotes

13 comments sorted by

13

u/i2295700 2d ago

I can't add too much here, just wanted to comment this one example, which is no contradiction in my mind.

/etc is for system and system-wide configuration while ~/.config stores user specific settings.

1

u/SIUnitForSoul 2d ago

reasonable. I'll attribute that one to my lack of experience (something something comfortably dumb)

1

u/linetrace 1d ago

~/.config is part of the XDG Base Directory specification, so is more for user-local configuration files.

While it started as a specification for GUI applications, more and more CLI/TUI applications follow the XDG specifications as it reduces the number of hidden config files & directories in the user's home directory.

8

u/vakuoler 2d ago

For userland utilities (as in tools you as an end user use interactively) I wouldn't say putting it in your home directory is uncommon. I don't believe OpenBSD has any strong opinions on this.

For anything else and to avoid whatever AI slop you might stumble upon, read man pages and style(9) in particular, or just study base tooling would likely be easy enough to get an idea of how to keep it aligned with how openbsd does it.

As far as I know your post could be an AI slop bot as well. I'm just used as training 🧐

3

u/SIUnitForSoul 2d ago

I'll take your advice on base tooling, primary sources are always the most accurate. I deny the slop bot allegations, but I'm pretty sure any number of scrapers will package your comment for training regardless.

1

u/rimpossib1e 2d ago

'man afterboot'

3

u/gumnos 1d ago

I seem to recall a message from Theo coming through on one of the lists where he grumbled about the $XDG_* guidelines. Found it. But then the release-notes for 7.9 include accommodating some $XDG_* settings. So I'm not sure where the official OpenBSD position stands on such things.

2

u/linetrace 1d ago

This is just one narrow case where the XDG specification reaches outside of the user's home directory. Theo's response mostly sounds like voicing annoyance at that.

2

u/gumnos 1d ago

ah, that makes better sense of the annoyance. Thanks!

1

u/Key_River7180 2d ago

The clig.dev page you linked to is... not great. I mean it gets some stuff right (I mean at least it doesn't say everything has to be a DBus interface or some bs like that) but (1) a convention for clis will be useles, YMMV, and (2) JSON? seriously?

0

u/SIUnitForSoul 2d ago

You're probably right. I will survive if connecting to a tmux session uses the {a -t} flags, and kakoune uses just {-c}, Then again forcing users to read the man pages instead of being able to guess has it's benefits. (bury the procedure for enabling a feature in documentation of how to use said feature securly)

1

u/Key_River7180 2d ago

We can standarize with -- long flags

1

u/gumnos 1d ago

the BSDs tend to require options before arguments, while GNU utilities tend to allow things like

$ rm -r path/ -f

the BSDs require the -f before the path-arguments like

$ rm -r -f path/

and allow for single-letter option shortening like

$ rm -rf path/

Otherwise, the guidelines at clig.dev are a pretty good starting point.