Takes account of the width of the current terminal for displaying the normal list #551

Merged
merged 3 commits into from Feb 29, 2012

Projects

None yet

2 participants

@hgdeoro
Contributor
hgdeoro commented Feb 5, 2012

This works only on *nix, since I don't know any portable way to get the current width of the console. This doesn't depends on any external library, and use the "stty" program, available in most of the *nix.

In case of error, silently fails and use the default value of 75.

Running -f tests/test_parallel.py --list changes from:

    Available commands:

    FabricTest    Nose-oriented test runner which wipes state.env and provid...
    TestParallel
    eq_           Shadow of the Nose builtin which presents easier to read m...
    server        Returns a decorator that runs an SSH server during functio...

to:

Available commands:

    FabricTest    Nose-oriented test runner which wipes state.env and provides file helpers.
    TestParallel
    eq_           Shadow of the Nose builtin which presents easier to read multiline output.
    server        Returns a decorator that runs an SSH server during function execution.
@hgdeoro
Contributor
hgdeoro commented Feb 5, 2012

After furder testing in many terminal sizes, I've found that I forgot to include the space used for the '...'. I'm fixin this now....

@hgdeoro
Contributor
hgdeoro commented Feb 5, 2012

Now it is working ok.

@bitprophet
Member

You should look around the source code more -- there is already a method for determining the local terminal size, which is used for e.g. setting the remote terminal size when needed. It's _pty_size in utils.py. Using this should make your patch a bit smaller/cleaner :)

@hgdeoro
Contributor
hgdeoro commented Feb 6, 2012

Ok, changed it to use _pty_size().

@bitprophet bitprophet merged commit 4c309b0 into fabric:master Feb 29, 2012
@bitprophet bitprophet added a commit that referenced this pull request Feb 29, 2012
@bitprophet bitprophet Changelog re #551 6450578
@bitprophet bitprophet added a commit that referenced this pull request Feb 29, 2012
@bitprophet bitprophet Backport #551 to 1.3 4c35743
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment