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

Setting cli prompt width to the user's terminal width #8016

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

vishwahiremat
Copy link
Contributor

Description

  • Getting the terminal size when the prompt model is created and setting the width to be terminal width.

Type of change

  • This pull request fixes a bug in Radius and has an approved issue (issue link required).
  • This pull request adds or changes features of Radius and has an approved issue (issue link required).
  • This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional).

Fixes: #5467

Contributor checklist

Please verify that the PR meets the following requirements, where applicable:

  • An overview of proposed schema changes is included in a linked GitHub issue.
  • A design document PR is created in the design-notes repository, if new APIs are being introduced.
  • If applicable, design document has been reviewed and approved by Radius maintainers/approvers.
  • A PR for the samples repository is created, if existing samples are affected by the changes in this PR.
  • A PR for the documentation repository is created, if the changes in this PR affect the documentation or any user facing updates are made.
  • A PR for the recipes repository is created, if existing recipes are affected by the changes in this PR.

@vishwahiremat vishwahiremat requested review from a team as code owners October 24, 2024 16:53
return Model{}, err
}

ti.Width = width
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know what the behavior is if we don't set the width? https://github.com/charmbracelet/bubbles/blob/master/textinput/textinput.go#L118

Does it autoscale?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that hardcoding is not the right thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tested it by not setting the width and it automatically sets the width to teminal width and it autoscales as well. I am going to update the changes to remove the setting of width property.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great 👍 simple solutions are good.

Signed-off-by: Vishwanath Hiremath <[email protected]>
Copy link

codecov bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 30.76923% with 9 lines in your changes missing coverage. Please review.

Project coverage is 59.31%. Comparing base (6842289) to head (4caca2f).

Files with missing lines Patch % Lines
pkg/cli/cmd/radinit/display.go 14.28% 6 Missing ⚠️
pkg/cli/prompt/list/list.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8016      +/-   ##
==========================================
- Coverage   59.32%   59.31%   -0.01%     
==========================================
  Files         560      560              
  Lines       37487    37495       +8     
==========================================
+ Hits        22238    22242       +4     
- Misses      13701    13706       +5     
+ Partials     1548     1547       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -148,7 +151,7 @@ func (m Model) View() string {
view := &strings.Builder{}
view.WriteString(m.prompt)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to implement wrapping for the prompt? or is that done automatically?

Signed-off-by: Vishwanath Hiremath <[email protected]>
Signed-off-by: Vishwanath Hiremath <[email protected]>
Signed-off-by: Vishwanath Hiremath <[email protected]>
@radius-functional-tests
Copy link

radius-functional-tests bot commented Oct 29, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository vishwahiremat/radius
Commit ref 4caca2f
Unique ID funcfe99ac1869
Image tag pr-funcfe99ac1869
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-funcfe99ac1869
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-funcfe99ac1869
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funcfe99ac1869
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funcfe99ac1869
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

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.

Set prompt width to the user's terminal width
2 participants