Skip to content

Commit 5d35bd6

Browse files
committed
correct README
1 parent cd6aa51 commit 5d35bd6

3 files changed

Lines changed: 46 additions & 29 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ See [nvim-plugin/README.md](nvim-plugin/README.md) for installation and full fea
7878
### 🚀 **Non-Interactive Query Mode**
7979
Execute SQL queries directly from the command line - perfect for scripting and automation:
8080

81-
![Description](docs/images/screenshot-20251012-182203.png)
81+
![Description](docs/images/screenshot-20251012-192832.png)
8282

8383
![Description](docs/images/screenshot-20250920-212340.png)
8484

21.8 KB
Loading

src/non_interactive.rs

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,31 +1461,6 @@ fn output_table<W: Write>(
14611461

14621462
// Set column headers
14631463
let columns = dataview.column_names();
1464-
table.set_header(&columns);
1465-
1466-
// Add data rows
1467-
for row_idx in 0..dataview.row_count() {
1468-
if let Some(row) = dataview.get_row(row_idx) {
1469-
let row_strings: Vec<String> = row
1470-
.values
1471-
.iter()
1472-
.map(|v| {
1473-
let s = format_value(v);
1474-
// Apply max width truncation if specified
1475-
if let Some(max_width) = max_col_width {
1476-
if s.len() > max_width {
1477-
format!("{}...", &s[..max_width.saturating_sub(3)])
1478-
} else {
1479-
s
1480-
}
1481-
} else {
1482-
s
1483-
}
1484-
})
1485-
.collect();
1486-
table.add_row(row_strings);
1487-
}
1488-
}
14891464

14901465
// Apply color styling if requested
14911466
if styled {
@@ -1504,16 +1479,58 @@ fn output_table<W: Write>(
15041479
// Convert DataView rows to Vec<Vec<String>> for styling
15051480
let rows: Vec<Vec<String>> = (0..dataview.row_count())
15061481
.filter_map(|i| {
1507-
dataview
1508-
.get_row(i)
1509-
.map(|row| row.values.iter().map(|v| format_value(v)).collect())
1482+
dataview.get_row(i).map(|row| {
1483+
row.values
1484+
.iter()
1485+
.map(|v| {
1486+
let s = format_value(v);
1487+
// Apply max width truncation if specified
1488+
if let Some(max_width) = max_col_width {
1489+
if s.len() > max_width {
1490+
format!("{}...", &s[..max_width.saturating_sub(3)])
1491+
} else {
1492+
s
1493+
}
1494+
} else {
1495+
s
1496+
}
1497+
})
1498+
.collect()
1499+
})
15101500
})
15111501
.collect();
15121502

15131503
if let Err(e) = apply_styles_to_table(&mut table, &columns, &rows, &config) {
15141504
eprintln!("Warning: Failed to apply styles: {}", e);
15151505
}
15161506
}
1507+
} else {
1508+
// No styling - add headers and rows normally
1509+
table.set_header(&columns);
1510+
1511+
// Add data rows
1512+
for row_idx in 0..dataview.row_count() {
1513+
if let Some(row) = dataview.get_row(row_idx) {
1514+
let row_strings: Vec<String> = row
1515+
.values
1516+
.iter()
1517+
.map(|v| {
1518+
let s = format_value(v);
1519+
// Apply max width truncation if specified
1520+
if let Some(max_width) = max_col_width {
1521+
if s.len() > max_width {
1522+
format!("{}...", &s[..max_width.saturating_sub(3)])
1523+
} else {
1524+
s
1525+
}
1526+
} else {
1527+
s
1528+
}
1529+
})
1530+
.collect();
1531+
table.add_row(row_strings);
1532+
}
1533+
}
15171534
}
15181535

15191536
// Write the table to the writer

0 commit comments

Comments
 (0)