Skip to content

Commit 39c99af

Browse files
authored
fix: Fix panic when there's no terminal width. (#691)
1 parent 3439462 commit 39c99af

12 files changed

+49
-43
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
- [Rust](https://github.com/moonrepo/tools/blob/master/tools/rust/CHANGELOG.md)
1111
- [Schema (TOML, JSON, YAML)](https://github.com/moonrepo/tools/blob/master/tools/internal-schema/CHANGELOG.md)
1212

13+
## Unreleased
14+
15+
#### 🐞 Fixes
16+
17+
- Fixed an issue where the terminal width isn't available in CI, causing a panic.
18+
1319
## 0.44.2
1420

1521
#### 🚀 Updates

Cargo.lock

+14-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ default-members = ["crates/cli"]
55

66
[workspace.dependencies]
77
anyhow = "1.0.95"
8-
async-trait = "0.1.83"
8+
async-trait = "0.1.84"
99
clap = "4.5.23"
1010
clap_complete = "4.5.40"
11-
compact_str = { version = "0.8.0", default-features = false, features = [
11+
compact_str = { version = "0.8.1", default-features = false, features = [
1212
"serde",
1313
] }
1414
dirs = "5.0.1"
@@ -17,11 +17,11 @@ extism-pdk = "1.3.0"
1717
http-cache-reqwest = "0.15.0"
1818
human-sort = "0.2.2"
1919
indexmap = "2.7.0"
20-
iocraft = "0.5.3"
20+
iocraft = "0.6.0"
2121
miette = "7.4.0"
2222
once_cell = "1.20.2"
2323
regex = { version = "1.11.1", default-features = false, features = ["std"] }
24-
reqwest = { version = "0.12.11", default-features = false, features = [
24+
reqwest = { version = "0.12.12", default-features = false, features = [
2525
"charset",
2626
"http2",
2727
"macos-system-configuration",
@@ -50,7 +50,7 @@ starbase_archive = { version = "0.9.0", features = [
5050
"zip",
5151
"zip-deflate",
5252
] }
53-
starbase_console = { version = "0.4.1", features = ["ui"] }
53+
starbase_console = { version = "0.4.2", features = ["ui"] }
5454
starbase_sandbox = { version = "0.8.0" }
5555
starbase_shell = { version = "0.6.9", features = ["miette"] }
5656
starbase_styles = { version = "0.4.10" }

crates/cli/src/commands/diagnose.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::components::{Issue, IssuesList};
22
use crate::helpers::fetch_latest_version;
33
use crate::session::ProtoSession;
44
use clap::Args;
5-
use iocraft::prelude::{element, Box, FlexDirection, Text};
5+
use iocraft::prelude::{element, FlexDirection, Text, View};
66
use serde::Serialize;
77
use starbase::AppResult;
88
use starbase_console::ui::*;
@@ -80,7 +80,7 @@ pub async fn diagnose(session: ProtoSession, args: DiagnoseArgs) -> AppResult {
8080

8181
session.console.render(element! {
8282
Container {
83-
Box(margin_bottom: 1, flex_direction: FlexDirection::Column) {
83+
View(margin_bottom: 1, flex_direction: FlexDirection::Column) {
8484
Entry(
8585
name: "Shell",
8686
value: element! {

crates/cli/src/commands/plugin/search.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::session::ProtoSession;
22
use clap::Args;
3-
use iocraft::prelude::{element, Box, FlexDirection, Size, Text};
3+
use iocraft::prelude::{element, FlexDirection, Size, Text, View};
44
use proto_core::registry::PluginFormat;
55
use proto_core::PluginLocator;
66
use starbase::AppResult;
@@ -58,7 +58,7 @@ pub async fn search(session: ProtoSession, args: SearchPluginArgs) -> AppResult
5858

5959
session.console.render(element! {
6060
Container {
61-
Box(padding_top: 1, padding_left: 1, flex_direction: FlexDirection::Column) {
61+
View(padding_top: 1, padding_left: 1, flex_direction: FlexDirection::Column) {
6262
StyledText(
6363
content: format!("Search results for: <label>{query}</label>"),
6464
)
@@ -116,7 +116,7 @@ pub async fn search(session: ProtoSession, args: SearchPluginArgs) -> AppResult
116116
}
117117
}))
118118
}
119-
Box(padding_bottom: 1, padding_left: 1, flex_direction: FlexDirection::Row) {
119+
View(padding_bottom: 1, padding_left: 1, flex_direction: FlexDirection::Row) {
120120
StyledText(
121121
content: "Find a plugin above that you want to use? Enable it with: ",
122122
)

crates/cli/src/commands/setup.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::shell::{
44
update_profile_if_not_setup, Export,
55
};
66
use clap::Args;
7-
use iocraft::prelude::{element, Box};
7+
use iocraft::prelude::{element, View};
88
use iocraft::FlexDirection;
99
use proto_shim::get_exe_file_name;
1010
use starbase::AppResult;
@@ -157,7 +157,7 @@ pub async fn setup(session: ProtoSession, args: SetupArgs) -> AppResult {
157157

158158
#(if should_launch_terminal {
159159
element! {
160-
Box(margin_top: 1) {
160+
View(margin_top: 1) {
161161
StyledText(
162162
content: "Launch a new terminal to start using proto!",
163163
style: Style::Success
@@ -166,14 +166,14 @@ pub async fn setup(session: ProtoSession, args: SetupArgs) -> AppResult {
166166
}
167167
} else {
168168
element! {
169-
Box(margin_top: 1, flex_direction: FlexDirection::Column) {
169+
View(margin_top: 1, flex_direction: FlexDirection::Column) {
170170
#(if should_print_exports {
171171
element! {
172172
Stack {
173173
StyledText(
174174
content: "Add the following to your shell profile and launch a new terminal to get started:"
175175
)
176-
Box(padding_top: 1, padding_left: 2) {
176+
View(padding_top: 1, padding_left: 2) {
177177
StyledText(
178178
content: exported_content.trim(),
179179
style: Style::MutedLight
@@ -187,7 +187,7 @@ pub async fn setup(session: ProtoSession, args: SetupArgs) -> AppResult {
187187
StyledText(
188188
content: "Add the following to your <property>PATH</property> to get started:",
189189
)
190-
Box(padding_top: 1, padding_left: 2) {
190+
View(padding_top: 1, padding_left: 2) {
191191
StyledText(
192192
content: if cfg!(windows) {
193193
format!(
@@ -208,7 +208,7 @@ pub async fn setup(session: ProtoSession, args: SetupArgs) -> AppResult {
208208
}
209209
})
210210

211-
Box(margin_top: 1) {
211+
View(margin_top: 1) {
212212
StyledText(
213213
content: format!(
214214
"Need help? Join our Discord <url>{}</url>",

crates/cli/src/commands/versions.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::components::create_datetime;
22
use crate::session::{LoadToolOptions, ProtoSession};
33
use clap::Args;
44
use indexmap::IndexMap;
5-
use iocraft::prelude::{element, Box};
5+
use iocraft::prelude::{element, View};
66
use proto_core::{Id, UnresolvedVersionSpec, VersionSpec};
77
use serde::Serialize;
88
use starbase::AppResult;
@@ -112,7 +112,7 @@ pub async fn versions(session: ProtoSession, args: VersionsArgs) -> AppResult {
112112
Container {
113113
#(versions.into_iter().map(|item| {
114114
element! {
115-
Box {
115+
View {
116116
#(if let Some(timestamp) = item.installed_at {
117117
element! {
118118
StyledText(
@@ -134,7 +134,7 @@ pub async fn versions(session: ProtoSession, args: VersionsArgs) -> AppResult {
134134

135135
#(aliases.into_iter().map(|(alias, version)| {
136136
element! {
137-
Box {
137+
View {
138138
StyledText(content: format!("{alias} <muted>→</muted> {version}"))
139139
}
140140
}

crates/cli/src/components/code_block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub struct CodeBlockProps {
1010
#[component]
1111
pub fn CodeBlock<'a>(props: &CodeBlockProps) -> impl Into<AnyElement<'a>> {
1212
element! {
13-
Box(
13+
View(
1414
flex_direction: FlexDirection::Column,
1515
padding_left: 2,
1616
padding_top: 1,

crates/cli/src/components/install_all_progress.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ pub fn InstallAllProgress<'a>(
4444
}
4545

4646
element! {
47-
Box(flex_direction: FlexDirection::Column, margin_top: 1) {
47+
View(flex_direction: FlexDirection::Column, margin_top: 1) {
4848
#(props.tools.iter().map(|(id, inner_props)| {
4949
element! {
50-
Box(key: id.to_string()) {
51-
Box(
50+
View(key: id.to_string()) {
51+
View(
5252
justify_content: JustifyContent::End,
5353
width: props.id_width as u16,
5454
) {
@@ -57,7 +57,7 @@ pub fn InstallAllProgress<'a>(
5757
style: Style::Id,
5858
)
5959
}
60-
Box(margin_left: 1) {
60+
View(margin_left: 1) {
6161
InstallProgress(
6262
default_message: inner_props.default_message.clone(),
6363
reporter: inner_props.reporter.clone(),

crates/cli/src/components/install_progress.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub struct InstallProgressProps {
1010
#[component]
1111
pub fn InstallProgress<'a>(props: &mut InstallProgressProps) -> impl Into<AnyElement<'a>> {
1212
element! {
13-
Box {
13+
View {
1414
Progress(
1515
default_message: props.default_message.clone()
1616
.unwrap_or_else(|| "Preparing install…".into()),

crates/cli/src/components/issues_list.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ pub fn IssuesList<'a>(props: &IssuesListProps) -> impl Into<AnyElement<'a>> {
2121
#(props.issues.iter().map(|issue| {
2222
element! {
2323
ListItem {
24-
Box {
24+
View {
2525
StyledText(content: "Issue: ", style: Style::MutedLight)
2626
StyledText(content: &issue.issue)
2727
}
2828
#(issue.resolution.as_ref().map(|resolution| {
2929
element! {
30-
Box {
30+
View {
3131
StyledText(content: "Resolution: ", style: Style::MutedLight)
3232
StyledText(content: resolution)
3333
}
3434
}
3535
}))
3636
#(issue.comment.as_ref().map(|comment| {
3737
element! {
38-
Box {
38+
View {
3939
StyledText(content: "Comment: ", style: Style::MutedLight)
4040
StyledText(content: comment)
4141
}

crates/cli/src/components/locator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn Locator<'a>(props: &LocatorProps<'a>) -> impl Into<AnyElement<'a>> {
2727
name: "Source",
2828
content: "GitHub".to_owned()
2929
) {
30-
Box(flex_direction: FlexDirection::Column) {
30+
View(flex_direction: FlexDirection::Column) {
3131
Entry(
3232
name: "Repository",
3333
value: element! {

0 commit comments

Comments
 (0)