<add pager to describe config command by samtholiy...
# atmos-dev
s
add pager to describe config command by samtholiya · Pull Request #1203 · cloudposse/atmos cc: @Erik Osterman (Cloud Posse) @Andriy Knysh (Cloud Posse) Ready for review. Fortunately not as big of a pr than others 😅
e
Can we make it more glamorous? see https://github.com/charmbracelet/glow
361034285-c2246366-f84b-4847-b431-32a61ca07b74.gif
At a minimum, can we copy this bottom bar look and feel? (not pink though!)
s
Trying this
Is this good. Note: I am going to add a help functionality soon. But wanted to show intermediate progress
also do we want all the functionality of the pager displayed in the gif you shared?
e
That doesn’t resemble the atmos color scheme
I prefer something closer to the original gif
I prefer dark over green
s
okay then what about the icon it is green and pink... does not go that well
i mean with the pink color.. or any other color
e
Nothing in atmos is pink either
Just keep it all dark
We don’t need a contrasting color there
s
okay got it so a status with different grey status border
e
Does the title bar at the bottom say what is being displayed
s
yes
e
Same gray as in the glow example
s
yep
got it
image.png
Hey @Erik Osterman (Cloud Posse) I would recommend to review the help and the view. I am assuming some test cases would be required but overall will write them once I know everything looks perfect.
@Erik Osterman (Cloud Posse) pinging you here again ☝️
e
s
Sorry my bad small error in my comment. The default pager is
false
So in this case if i choose to keep the default The issue would be our new pager would not be enabled by default
we can add a release note that pager would be the new default
and set the default to true
e
Yes, ok to change the default behavior IMO. Since if no TTY, there's still no pager (so it shouldn't affect automation)
And make the default
true
which is to use the native pager
and if it's
false
we disable
and if it's anything else, we use the previous behavior which is to run the pager.
So this should work:
Copy code
settings:
  terminal:
    pager: less
as well as
Copy code
settings:
  terminal:
    pager: !env PAGER
We support
!env
at the conf level
Note, the pager can contain spaces.
e.g.
less -FRX
s
Hey @Erik Osterman (Cloud Posse) Because of viper
Copy code
settings:
  terminal:
    pager: less
Does not evaluate to pager: true even if that is the default My suggestion is we would require this for everything else. I can create a task for this in backlog. Meanwhile let us first continue adding this pager to every describe command starting with this
Also i guess eventually we should be validating the atmos schema before reading it. That would be much better so that user does not get unexpected results 😅
e
My suggestion is we would require this for everything else.
Require what? not sure what "this" is here.
Does not evaluate to pager: true
Not enough information. Does not evaluate in this context means what? It errors? it's null? it's a string "true"
Did we let
pager
be any?
Copy code
Pager any `yaml:"pager"`
s
Does not evaluate in this context means what?
pager
is
true
by default because we set the defaults in viper Now if user is good enough he can set the value to be
true
or
false
and that will be catched by viper so we don't need to worry. But the issue arrises when user is not entering the correct config that is let us say he sets
pager
to
less
in config file or env (Flag is by default validated) in this case the value of
pager
is set to
false
by viper
While the behavior we want is for any other value the value of pager should be set to
true
e
isn't that b/c you have the type of pager wrong?
The type needs to be any
s
but why should it be any?
e
because true/false are truthy values and considered boolean
s
it should be bool pager could be true or false right?
e
and "less" is a string
Copy code
settings:
  terminal:
    pager: less
less is not true or false
s
okay wait why we want to support less?
e
it's the command to run.
We support
less
today based on the
PAGER
env (which could be
less
or
more
or anything)
thing is
PAGER
is set by default on most systems. So if we just use
boolean
we'll basically never get to the native pager.
we'll only get the one in
PAGER
unless we run atmos like:
Copy code
PAGER= atmos describe ...
or
unset PAGER
s
why are we not using
ATMOS_PAGER
?
e
PAGER is a unix default used by 99% of apps
we can/should also support ATMOS_PAGER
but we have to support PAGER
s
okay...
got it now
yes then it makes sense to set it to any / string is also fine to be honest 😅 But ok got your context
Thanks for the clarification
e
also be cautious that YAML autoamtically decodes truthy values like true/false on/off
it's fine if they use on/off
just we just need to know that
true
is automatically considered a boolean and not a string
s
cool 🙂
Ready to go 🙂
I am creating a followup pr that would be based on this pr for
describe component
command
@Erik Osterman (Cloud Posse) fixed the comment
@Erik Osterman (Cloud Posse) let us review this. 🙂