Skip to content
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

Possible to change COLUMNS environment variable? #1847

Open
gitressa opened this issue Oct 31, 2019 · 16 comments · May be fixed by lando/core-next#42 or lando/core#50
Open

Possible to change COLUMNS environment variable? #1847

gitressa opened this issue Oct 31, 2019 · 16 comments · May be fixed by lando/core-next#42 or lando/core#50
Labels
core-next Issues with Lando 4 runtime

Comments

@gitressa
Copy link
Contributor

gitressa commented Oct 31, 2019

The command line column width is set to 256 columns:

$ lando ssh -s appserver -c env | grep -i col
COLUMNS=256

Is it possible to change this? I found the Environment page, and tried tweaking the value by creating a new defaults.env file, and adding this:
COLUMNS=80

... and this to my .lando.yml file:

env_file:
  - defaults.env

... and rebuilding Lando, but it doesn't seem to work.

Is it even possible to change this? I would be fine setting this globally, for all my Lando environments.

@gitressa gitressa added the task label Oct 31, 2019
@stale
Copy link

stale bot commented Dec 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues.

@stale stale bot added the stale Issue has been auto-flagged as stale label Dec 1, 2019
@pirog pirog removed the stale Issue has been auto-flagged as stale label Dec 2, 2019
@stale
Copy link

stale bot commented Jan 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues.

@stale stale bot added the stale Issue has been auto-flagged as stale label Jan 2, 2020
@gitressa
Copy link
Contributor Author

gitressa commented Jan 2, 2020

stalebot seems keen to close this issue ...

@stale stale bot closed this as completed Jan 9, 2020
@gitressa
Copy link
Contributor Author

gitressa commented Jan 9, 2020

It says on https://github.com/probot/stale#is-closing-stale-issues-really-a-good-idea

A comment is all it takes to keep the conversation alive.

Yet, now it's closed ...

@generalredneck
Copy link
Contributor

Also looking for this feature.

@gitressa
Copy link
Contributor Author

Yes, but stale bot closed the issue two weeks ago, so the maintainers might not see this issue any longer.

pirog removed the wontfix label on Dec 3, 2019

... gives me the impression that this could potentially be looked on. Creating a new identical issue doesn't seem optimal.

@pirog
Copy link
Sponsor Member

pirog commented Mar 21, 2020

AFAIK this is already possible with either an environment file, service level overrides or setting a user space lando global config that overrides the appEnv key.

If those don't work this is something we could look into at some point but i'm guessing it would fall lower on the priority list.

@gitressa
Copy link
Contributor Author

Thanks for your input @pirog. I went back and experimented some more. I could have sworn that I already tried this, but perhaps I forgot to rebuild ... but this works:

Set per project in .lando.yml, as a service level override:

services:
  appserver:
    overrides:
      environment:
        COLUMNS: "140"

...or set with a user space lando global config in ~/.lando/config.yml:

appEnv:
  COLUMNS: "140"

Looking in the output of lando config helped me debug.

  • Ubuntu 18.04
  • Lando 3.0.0-aft.2
  • Drush 9.7.2

I understand it is a matter of taste, but would it make sense to reduce the default number of columns from 256 to for example 180 in https://github.com/lando/lando/blob/master/plugins/lando-core/index.js? Looking at my own command line with COLUMNS=238 makes the font quite small ...

@reynoldsalec
Copy link
Sponsor Member

We should revisit this in 4.x...@pirog indicated that in the future we could set container COLUMNS using the host value of COLUMNS, which might be another good solution to follow the user's lead.

@eldair
Copy link

eldair commented Jul 23, 2022

@reynoldsalec
Would using host value for COLUMNS update the value on terminal resize if it is updated on host?

@pirog
Copy link
Sponsor Member

pirog commented Aug 2, 2022

@eldair i think it would depend on the usage. in the future im guessing COLUMNS will be set on "execs" which means they will update the next time you run a lando tooling-command. for non cli usage i think youll need to rebuild the app to reset the envvars.

@eldair
Copy link

eldair commented Aug 2, 2022

@pirog yeah, I was interested in CLI/tooling (like artisan command)

@hailwood
Copy link
Contributor

Yeah artisan commands is my exact usecase here.
Especially with their new formatting it's now quite hard to read when COLUMNS is set incorrectly.

Setting the COLUMNS manually is problematic with splitting/resizing terminals

@stale
Copy link

stale bot commented May 22, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues.

@stale stale bot added the stale Issue has been auto-flagged as stale label May 22, 2023
@AaronFeledy
Copy link
Collaborator

/unstale

@stale stale bot removed the stale Issue has been auto-flagged as stale label Jul 29, 2023
@phil-s
Copy link

phil-s commented Sep 20, 2023

For lando 3 you could pass the local COLUMNS value to lando ssh by using and modifying the wrapper script at #2188 (comment) to add that variable in addition to the TERM value currently being passed along.

(Be aware that other non-trivial env-var values, or non-trivial commands, may fall foul of lando/cli#212; but the likes of env TERM=${TERM} COLUMNS=${COLUMNS} ... are going to be fine.)

You might need to use tput cols to obtain a value earlier in the script. My comments about "older versions of tput" are themselves somewhat old now, so YMMV on the extra hoops here...

# Check how many columns the terminal has.  Older versions of tput return
# "80" here when both stdout and stderr have been redirected, so running
# 'tput cols 2>/dev/null' in a subshell is a problem.  Instead we check
# whether it exits successfully, so that we can call it again without the
# stderr redirection.
if [ -z "${COLUMNS}" ]; then
    if command -v tput >/dev/null 2>&1 && tput cols >/dev/null 2>&1; then
        COLUMNS="$(tput cols)"
    fi
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-next Issues with Lando 4 runtime
Projects
None yet
8 participants