-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Add command line option for short banner #50726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I've reviewed and approve @c42f's contribution to this PR. |
…h names don't make CI fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've looked through all this again including your parts @LilithHafner. I added another two tiny tests to cover the command line argument more thoroughly.
It looks good to me I say we merge it as soon as CI passes.
Personally I'll be turning this on by default for all my Julia aliases :)
The windows test failure here looks spurious - something to do with temporary files and the file system. |
@LilithHafner did you by any chance see my efforts to support multiple banner sizes based on the terminal resolution? |
I did not, would you share a link? |
I had a look when I sent that message, unfortunately it seems like the discussion has disappeared into the slack-hole. That said, I can do a brief recap and demo. I don't think it's very nice how with a narrow or small terminal window, the Julia banner can (a) get ruined by line wrapping, or (b) take up almost all of the window. So, I designed a number of alternative scaling of the Julia banner that are picked between based on |
I love the rendering of "Julia" in the 8x55 version! |
The 8 or less rows options do assume the Julia mono font, but I like them. I'd be happy to PR these once StyledStrings is in, but I do think we'd then want to switch out |
The deadline to cleanly swap that out (i.e. drop support for |
Mmm, I'd also like to get StyledStrings in with 1.11 (and Stefan/Kristopher/Jameson seemed to think that reasonable I spoke with them at JuliaCon). |
For @c42f and others who may want to opt into this by default, here's a little monstrosity to put in startup.jl that does that # Use --short banner by default (https://github.com/JuliaLang/julia/pull/50726#issuecomment-1939089858)
if VERSION >= v"1.11.0-DEV.222" && isinteractive()
c_options = cglobal(:jl_options, Base.JLOptions)
opts = unsafe_load(c_options)
if opts.banner == -1 && isa(stdin, Base.TTY)
# opts.banner = 2
fields = fieldnames(Base.JLOptions)
args = (f == :banner ? 2 : getfield(opts, f) for f in fields)
new_opts = Base.JLOptions(args...)
unsafe_store!(c_options, new_opts)
end
end |
That almost makes me wonder if a |
Or a ShortBanner package. Then it would just be |
FWIW, I think a slightly more standard form of this would use: unsafe_store!(Ptr{typeof(banner)}(c_options) + fieldoffset(opts, :banner), 2) |
That julia> only(methods(fieldoffset))
fieldoffset(x::DataType, idx::Integer)
@ Base reflection.jl:917 |
Ugh, you are right, and it really should exist for this use case. Anyways, here is the verbose version of it then:
|
Oh my. I love that use of |
(it has color, too)