micharbet/CLE

Allow different configs cf-HOSTNAME

Closed this issue · 7 comments

We have a few servers that share the /home partition via NFS.
In that case it is useful to have different config (colors) for each server.
Default is ~/.cle-username/cf
Server specific version is ~/.cle-user/cf-hostname
It has to be created manually.
This tweak does it:
[[ -r $CLE_D/cf-$CLE_SHN ]] && CLE_CF=$CLE_D/cf-$CLE_SHN

This is indeed very good idea!
Need to think more than I'm capable at this (night)time. But this will be implemented too.

Hi Vladki,

I implemented your idea in slightly different way: The config file will contain hostname by default. Seamless transition from cf to cf-hostname is ensured.

I'd appreciate if you check this new feature. Instead updating please kindly check branch 'NovaDev', download either clerc or clerc.sh and temporarily replace your environment. I strongly believe you exactly know what to do. (ask me if not, of course)

https://github.com/micharbet/CLE/tree/NovaDev
3244ca3

Let me know if it works, if something else would be better, or anything related.
Thank you in advance!

-michael-

Hello Michal,

it seems to work well. I was just surprised that for other files you use short host name (like rc-$CLE_SHN, tw-$CLE_SHN), and for config you use full host name. Not a big problem, just consistency and esthetics ;)

Vladki

OK. just an idea for cle_shn/fhn. What about an option how many levels to remove from FHN to form SHN? Your current default is 2, mine is 1. Maybe someone will have use for more, like host.fit.vut.cz...
So a check to leave at least the first part would be needed...

Hi Vladki,
I've just merged latest changes into master branch with almost all of your inspirations. Including the customized shortening. Define variable $CLE_SRE in tweak file and create your very own shortened hostname. In your case you can use following statement to remove just one level from FQDN:
CLE_SRE="'s:\.*[^.]*$::'"

Note that you can create more complicated statements combining several expressions like:
CLE_SRE="-e 'expr1' -e 'expr2' ..."

Also double quotes and single quotes are necessary!
Everything is already documented in file HOWTO.md ( read using cle doc )

I hope it's all useful, let me know if something needs improvements
Kind regards
-michael-

Thank you, works perfectly. I have already used the double expression option:

CLE_SRE="-e 's:\.[^.]*$::' -e 's:\.webstep::'"
and now my CLE_WT is much simpler:

# window title
_setwt () {
        [[ $TERM =~ linux ]] && return # no tits on console
        CLE_WT=${CLE_SHN}:
        [[ $USER = root ]] && CLE_WT=${CLE_WT^^}
}

Vladki