<isene>
I've started to use rsh as my only shell. Now I run into the following; When starting zsh first and then going into rsh, the LS_COLORS are naturally inherited by rsh as zsh loads it as usual. But, when I don't go via zsh and go straight into rsh, my LS_COLORS are not loaded. How can I load my LS_COLORS from within rsh (adding a line or two that loads the file that zsh so naturally loads; the file
<isene>
starts with `LS_COLORS LS_COLORS='bd=38;5;196;4:` etc and ends with `export LS_COLORS`)
friendlypunk has quit [Remote host closed the connection]
grenierm has quit [Ping timeout: 245 seconds]
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 255 seconds]
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 250 seconds]
dhruvasagar has joined #ruby
rfmc has joined #ruby
dhruvasagar has quit [Ping timeout: 260 seconds]
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 265 seconds]
<leah2>
what happens is eval `dircolors`
rapha has quit [Server closed connection]
rapha has joined #ruby
rapha has quit [Changing host]
rapha has joined #ruby
dhruvasagar has joined #ruby
johnjaye has quit [Ping timeout: 256 seconds]
FabioPort has quit [Quit: Client closed]
dhruvasagar has quit [Ping timeout: 268 seconds]
FabioPort has joined #ruby
dhruvasagar has joined #ruby
sympt has quit [Server closed connection]
sympt has joined #ruby
dhruvasagar has quit [Ping timeout: 255 seconds]
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 265 seconds]
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 255 seconds]
hightower3 has joined #ruby
BazzaBazaa has joined #ruby
hightower2 has quit [Ping timeout: 260 seconds]
yetoo has joined #ruby
donofrio has joined #ruby
rfmc has quit [Quit: Leaving]
markong has joined #ruby
johnjaye has joined #ruby
BazzaBazaa has quit [Ping timeout: 245 seconds]
FabioPort has quit [Quit: Client closed]
roshanavand_ has joined #ruby
<isene>
Fixed it - I needed a way to read a specific LS_COLOR setup
dhruvasagar has joined #ruby
BazzaBazaa has joined #ruby
PedroG1 has quit [Server closed connection]
hightower3 has quit [Remote host closed the connection]
PedroG1 has joined #ruby
BazzaBazaa has quit [Remote host closed the connection]
BazzaBazaa has joined #ruby
reset has joined #ruby
roshanavand_ has quit [Ping timeout: 260 seconds]
Bish has quit [Ping timeout: 240 seconds]
dhruvasagar has quit [Ping timeout: 265 seconds]
Bish has joined #ruby
roshanavand_ has joined #ruby
BazzaBazaa has quit [Ping timeout: 245 seconds]
markong has quit [Ping timeout: 268 seconds]
roshanavand_ has quit [Ping timeout: 260 seconds]
yassernasc has joined #ruby
Bish has quit [Ping timeout: 260 seconds]
caedmon has joined #ruby
dhruvasagar has joined #ruby
caedmon has quit [Ping timeout: 260 seconds]
dhruvasagar has quit [Ping timeout: 250 seconds]
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 240 seconds]
BazzaBazaa has joined #ruby
Bish has joined #ruby
dhruvasagar has joined #ruby
joto has quit [Server closed connection]
joto has joined #ruby
<isene>
Here's a tricky one is you're up for a challenge. rsh (https://github.com/isene/rsh) is almost ready for being a valid login shell. It will do most of what I want - and it does handle my full LS_COLOR setup (https://github.com/isene/LS_COLORS) and works nicely with rtfm (https://github.com/isene/RTFM) when run from a terminal - but NOT as a login shell. As a login shell it does show colors correctly
<isene>
with ls, but not when I launch rtfm. There must be some environment variable that is not set or some such. Any pointers?
<isene>
It gets weirder; I use rsh as a login shell and launch rtfm - colors are gone. I quit rtfm, launch zsh and then rtfm - colors are perfect. I quit rtfm and zsh and I'm back in rsh. Then I launch bash and then rtfm - colors are half-gone. Both zsh and bash have $TERM = "rxvt-unicode-256color", so that's not the issue. What is?
markong has joined #ruby
<bhaak>
isene: does it work better if you issue 'stty sane' after quitting rftm?
<isene>
After quitting rtfm? I want the colors to work In rtfm... does stty sane do anything for that?
<bhaak>
it's possible that rtfm screws up the color settings
<bhaak>
"infocmp | head -n2" will tell if every shell is actually using the same terminfo file
<isene>
cool, I'll check that
<isene>
I think you hit it :-) "infocmp | head -n2" shows the same for bash and zsh, but not for rsh. How do I make it the same in rsh?
<bhaak>
oh, is ENV['TERM'] not set by rsh? as a login shell, you have to do all of that yourself :)
<isene>
It should be "rxvt-unicode-256color|rxvt-unicode terminal with 256 colors (X Window System)" it seems
gonix has joined #ruby
<leah2>
so you didnt set TERM
<leah2>
but a login shell should have TERM set
<llua>
shells don't set TERM
<llua>
people mistakely do so in their dotfiles for whatever reason, but shouldn't
<leah2>
(before it launches i mean)
<ox1eef_>
That's my understanding too - llua
<bhaak>
oh, right, it should set SHELL
<isene>
It should set SHELL? To what?
<bhaak>
but if used as a login shell, the login process (systemd, login, whatever) should set TERM
<bhaak>
isene: it's not a problem that SHELL is not for your case (I think) but it should do it for other programs
<leah2>
imo SHELL should be set by login(1) to the passwd entry
shokohsc53 has joined #ruby
<leah2>
> The environment variable values for $HOME, $USER, $SHELL, $PATH, $LOGNAME, and $MAIL are set according to the appropriate fields in the password entry.
yassernasc has quit [Remote host closed the connection]
<isene>
I have done chsh to make my shell 'rsh'
<leah2>
then SHELL should be set
yassernasc has joined #ruby
<bhaak>
a quick glance at the rsh code doesn't show any filtering of env variables. so that's not it either
shokohsc5 has quit [Ping timeout: 255 seconds]
shokohsc53 is now known as shokohsc5
<leah2>
but also login should set TERM to a default if it isnt set yet
gonix has quit [Remote host closed the connection]
<adam12>
Grrr. OptionParser::InvalidArgument has it's values eaten.
<adam12>
It renders the message to the exception useless when used when you normally want it, during option parsing.
BazzaBazaa has quit [Remote host closed the connection]
yassernasc has quit [Remote host closed the connection]
BazzaBazaa has joined #ruby
yassernasc has joined #ruby
<isene>
Great - half-way there :-) With TERM and SHELL set (in rsh, not in the config file), colors are visible, but like with bash in console (without X), it only shows some colors - the 16 usual ones, not the full 256. But launching rtfm from zsh it gives the full 256 color experience. So, zsh = 256 colors, bash & rsh = 16 colors
<isene>
All three shows the same output on "infocmp | head -n2"
Furai has quit [Quit: WeeChat 3.8]
<bhaak>
I thought the Linux console doesn't support 256 colors? not even 16, only the basic 8
<leah2>
it does 16 i think
keypresser86 has joined #ruby
Furai has joined #ruby
<leah2>
i think it just depends when lscolors is run tbh
<adam12>
Also, sigh. I decided to disallow certain _very large_ .gem's from being documented on gemdocs.org. Mostly because they contain a ton of binaries and very little source so there's no value in documentation. One in particular has been 200+MB at times (but latest release is about 80MB)
<adam12>
That one in particular is now published under a half-dozen names. All the same content.
<leah2>
can't you just not extract those files?
<adam12>
I'll have to add a file size check, which I never actually needed.
<leah2>
hm, no -B in ruby?
yassernasc has quit [Remote host closed the connection]
<pjb>
Hi! I'm trying to compile github ruby. My yaml.h and libyaml are in ~/opt/{include,lib}; I'm using PREFIX=$HOME/opt ; export CPPFLAGS=-I$PREFIX/include ; export LDFLAGS=-L$PREFIX/lib ; ./autogen.sh && mkdir -p build && cd build && ../configure --prefix=$PREFIX && make install # but it fails on ../../../ext/psych/psych.h:7:10: fatal error: yaml.h: No such file or directory
<pjb>
<pjb>
I've tried some variations without any difference. (eg. cppflags instead of CPPFLAGS).
<adam12>
pjb: I'd try passing an option to ./configure instead of using CFLAGS/etc.
yassernasc has quit [Remote host closed the connection]
<isene>
Guys, thanks for the help. Got everything in order now (with 16 colors in console on all shells)
<adam12>
pjb: Hmm :(
<adam12>
isene: Nice :)
<pjb>
The Makefile and templates and everything seems ok, but still. I don't understand why it doesn't work.
<pjb>
I'll have to debug it tomorrow…
<adam12>
pjb: If you have a working Ruby version already, I might try to install the psych gem independently, with that same flag and see if it builds.
<adam12>
Even better, fetch the gem, and ext/mkmf.rb and see what the Makefile generates.
<pjb>
Well, that's the point, I've had difficulties with this gem already with the previous (pre-installed) versions of ruby.
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<pjb>
No amount of apt install or apt update/upgrade helped.
mynameisdebian has joined #ruby
<adam12>
isene: I noticed you cribbed the TTY::Cursor implementation. I kind of wish it was in ruby stdlib since I don't think its changed in 40 years.
<adam12>
pjb: Do you have a working Ruby at all? I wonder if you could try `gem unpack psych; cd psych-51.10; ruby ext/psych/extconf.rb -- --with-libyaml-dir=/opt; make` and see if it has a different error.
john__ has quit [Ping timeout: 260 seconds]
<adam12>
pjb: there is a miniruby compiled in ruby/ruby source sometimes, that you could maybe use.
<adam12>
The makefile it generates looks correct, and compiling fails because it can't find the .h file for me (which is right). But if you can get the gem to build, I wonder if it's the ruby configure script not passing args down.
<adam12>
Unfortunately, there's a ton of moving pieces in the middle.
john__ has joined #ruby
eddof13 has joined #ruby
BazzaBazaa has quit [Remote host closed the connection]
mynameisdebian has quit [Ping timeout: 240 seconds]
caedmon has quit [Read error: Connection reset by peer]
caedmon has joined #ruby
<pjb>
this is on a ubuntu 18.04 server.
<pjb>
Anyways, end of the day, I'll see that tomorrow.
dhruvasagar has quit [Ping timeout: 240 seconds]
<isene>
adam12: Yes, it should be in Ruby stdlib
caedmon has quit [Ping timeout: 268 seconds]
<joto>
I'm learning active record and was wondering if you could use the find_or_create_by on an associated record? E.g. I have a School which has_one Report. How would I go about returning or creating the (missing) Report?
<joto>
I now have the following: School.where('abbreviation = ?', "Learning playground") .includes(:report) but that does actually return the School where I'd need the Report to be returned or created
dhruvasagar has joined #ruby
caedmon has joined #ruby
<joto>
was thinking of maybe doing it vice versa: build up a rails query starting from Report.find_or_create_by(school_id: 7). However I'd need to look up that school_id first and was wanting to prevent having to fire two queries at the database :-).
teclator has quit [Ping timeout: 255 seconds]
<adam12>
pjb: Probably a lot of things broken here. I might try adding `--disable-gems` to your `ruby ext/` call. so `ruby --disable-gems ext/psych/extconf.rb -- --with-libyaml-dir=/opt`
phenom has quit [Ping timeout: 268 seconds]
<weaksauce>
joto find or create by is only really for the main class
<weaksauce>
school = School.where('abbreviation = ?', "Learning playground") .includes(:report)
<weaksauce>
note school.where and includes is already two db calls
<weaksauce>
it might be one actually
<weaksauce>
on a has_one
centri51 has joined #ruby
<joto>
alright. thanks! I would need two calls anyway. I was reading up on using .join and .where in the meantime but Report.joins(:schools).where('schools.abbreviation' == "Learning playground") seems illogical in combination with find_or_create_by
_ht has joined #ruby
<weaksauce>
if it knows that it is a has_one it might do a join but i'm not sure... you can certainly try it and look at the logs to see what was done
<joto>
alright thanks for the assistance
<weaksauce>
or drop into a console and read what the sql would have been
<adam12>
ox1eef_: I'm trying to improve ri a bit. In a bunch of places, they raise OptionParser::InvalidArgument with a message, but it's swallowed by InvalidArgument#set_option.
<adam12>
ox1eef_: So if you raise OptionParser::InvalidAgument, "#{file} not found", it's eaten with a generic `invalid argument --file=notfound`
<adam12>
I need to dig into it a bit more, but I suspect there's 20 years of cruft to sift through.
teclator has joined #ruby
dhruvasagar has quit [Ping timeout: 255 seconds]
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 255 seconds]
<ox1eef_>
Not sure about ri. I enjoyed reading through the OptionParser code though.
dhruvasagar has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12>
ox1eef_: Do you ever use ri?
<adam12>
I feel like we've gradually moved away from it, which is a shame since it's super convenience.
dhruvasagar has quit [Ping timeout: 255 seconds]
<ox1eef_>
I don't use it at all. I never did though. Lately I love man pages, and I guess those are at least sort of similar.
dhruvasagar has joined #ruby
<leah2>
i use it all the time o.o
<ox1eef_>
I'm probably missing out.
<rapha>
could never even get used to those. if i want to read a man page i'll end up on some website that has it. somehow it feels better if the terminal is where you "do" stuff and the browser is where you "learn" or "read" stuff.
Al2O3 has quit [Ping timeout: 260 seconds]
<adam12>
Learning man/apropos was super helpful.
<adam12>
I feel like ri has some hidden tricks but it has never seen much love. I have a 1 line PR open for 14+ months now.
<rapha>
wow
<adam12>
I'm tempted to make a new ri to experiment with.
<ox1eef_>
That's often worth it.
yassernasc has joined #ruby
<ox1eef_>
Maybe checkout yri too (yards version).
dhruvasagar has quit [Ping timeout: 255 seconds]
dhruvasagar has joined #ruby
yassernasc has quit [Remote host closed the connection]
<adam12>
leah2: You ever seen the `ri gem_name:` feature work?
yassernasc has joined #ruby
<adam12>
(supposed to list all files)
centri51 has quit [Ping timeout: 240 seconds]
<adam12>
> If the gem name is followed by a ':' all files in the
<adam12>
gem will be shown.
dhruvasagar has quit [Ping timeout: 265 seconds]
dhruvasagar has joined #ruby
Al2O3 has joined #ruby
TomyWork has quit [Remote host closed the connection]
dhruvasagar has quit [Ping timeout: 260 seconds]
dhruvasagar has joined #ruby
<ox1eef_>
Nothing known about test-unit.
<ox1eef_>
That's what I see.
<ox1eef_>
I think it has to generate a cache or something like that. Might be it.
ollysmith has quit [Quit: ZNC 1.8.2+deb3.1 - https://znc.in]
dhruvasagar has quit [Ping timeout: 265 seconds]
<leah2>
oh, for gems hrm
ollysmith has joined #ruby
<adam12>
ox1eef_: Maybe. I have tried looking at the cache and it seems correct.
<adam12>
leah2: Just curious. I've never seen it work outside of `ri ruby:` and wondered if I was missing something. I can't remember it _ever_ working over all these years.
<ox1eef_>
Sounds like a great feature. Along with "gem:README" but not working "out of the box" for me.
<leah2>
iirc i had gems pollute it so :p
<adam12>
I was thinking about writing my own pager for my own "ri" yesterday, musing about the functionality. Then forgot that I use / to search a ton, and now I'm sad because it seems so much more complex now.
<adam12>
(less's build in / search)
<ox1eef_>
Pry implements a poor man's pager (for Windows). It leaves a lot to be desired compared to less but could be a starting point.
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12>
I think I see it.
mexen has joined #ruby
eddof13 has joined #ruby
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 260 seconds]
<adam12>
Passing a custom error to OptionParser::InvalidArgument seems to be an anti-pattern. Lots of people do it, but you run the risk of your message being trampled when set_option is called. But it's only called in some scenarios (like o.on()). Typically, it accepts _just_ the argument value (or values) that were invalid.
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 268 seconds]
roadie` has joined #ruby
dhruvasagar has joined #ruby
roadie` has quit [Remote host closed the connection]