Skip to content

text resizing based on the terminal column's width for sync logs #136

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

Merged
merged 15 commits into from
Apr 26, 2021

Conversation

roshan04
Copy link
Contributor

@roshan04 roshan04 commented Apr 15, 2021

We will be widening or shorting the width of the column which shows the sync result logs for individual specs based on the current terminal's column width.

This PR adds the dynamically adjusting the specs listing column width based on the terminal/process' col size. Provides an option --no-wrap to disable the feature in case the user does not want the column to be resized.

@@ -13,7 +13,8 @@ let specSummary = {
"specs": [],
"duration": null
}

let noWrap = utils.searchForOption('--no-wrap')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add validation around --no-wrap?

@@ -221,6 +221,9 @@ var argv = yargs
'local-config-file': {
describe: Constants.cliMessages.RUN.LOCAL_CONFIG_FILE,
type: "string"
},
'no-wrap': {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a default value, type, and alias

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -81,7 +82,7 @@ let printSpecsStatus = (bsConfig, buildDetails) => {
whileProcess(callback)
},
function(err, result) { // when loop ends
logger.info("\n--------------------------------------------------------------------------------")
noWrap ? logger.info("\n--------------------------------------------------------------------------------") : logger.info("\n" + "-".repeat(terminalWidth))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use noWrap? to determine separator length in both cases? Something like

logger.info("-".repeat(noWrap ? X : terminalWidth))

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The X is default and we would want the existing behaviour to continue in case of a no-wrap. We can make it something like:

logger.info("-".repeat(noWrap ? 80 : terminalWidth))

Where 80 is the current number of the - which are being printed.

suryart added 4 commits April 19, 2021 20:18
- Added util for setting the no-wrap on process level as a BOOL val.
- Moved the no-wrap logic to centralizeds place.
- Added default value and the type accepted in the help text for yargs.
@suryart suryart changed the title Proper text in resized terminal windows test resizing based on the terminal column's width for sync logs Apr 19, 2021
@suryart suryart changed the title test resizing based on the terminal column's width for sync logs text resizing based on the terminal column's width for sync logs Apr 19, 2021
SagarGaniga
SagarGaniga previously approved these changes Apr 20, 2021
Copy link
Collaborator

@SagarGaniga SagarGaniga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@prateekbstack
Copy link
Collaborator

LGTM

@SagarGaniga SagarGaniga merged commit eb47ede into master Apr 26, 2021
@suryart suryart deleted the proper_text_in_resized_terminal_windows branch May 19, 2021 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants