Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitissues/issues/0000000059/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
_version: 1
id: 59
title: '[cmd/show] remove title from metadata table'
state: new
state: resolved
type: ''
labels: []
reporter: t.burkard
assignee: ''
assignee: t.burkard
priority: ''
due_date: ''
relationships: {}
created: 2026-01-27T20:35:19Z
updated: 2026-01-27T20:35:19Z
updated: 2026-01-27T21:14:20Z
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- [cmd/show] removed title from metadata table in markdown (#59)
- [config] moved `export_csv_separator` from config to settings --> YAML schema v2 (#58)
- [structure] added lib, implemented separation between cmd and cli

Expand Down
2 changes: 0 additions & 2 deletions src/cmd/show.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ fn generate_content_metadata(id: u32, meta: &Meta) -> String {
content.push_str(&format!("| **field** | {:width$} |\n", "**value**"));
content.push_str(&format!("| ----------------- | {} |\n", "-".repeat(width)));
content.push_str(&format!("| **id** | {:width$} |\n", values["id"]));
content.push_str(&format!("| **title** | {:width$} |\n", values["title"]));
content.push_str(&format!("| **state** | {:width$} |\n", values["state"]));
content.push_str(&format!("| **type** | {:width$} |\n", values["type"]));
content.push_str(&format!("| **labels** | {:width$} |\n", values["labels"]));
Expand All @@ -84,7 +83,6 @@ fn get_values(meta: &Meta) -> (usize, HashMap<String, String>) {
let mut values = HashMap::new();

values.insert("id".to_string(), meta.id.to_string());
values.insert("title".to_string(), meta.title.clone());
values.insert("state".to_string(), meta.state.clone());
values.insert("type".to_string(), dash_if_empty(&meta.type_));
values.insert("labels".to_string(), dash_if_empty(&meta.labels.join(",")));
Expand Down
1 change: 0 additions & 1 deletion tests/includes/show_empty.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
| **field** | **value** |
| ----------------- | -------------------- |
| **id** | 1 |
| **title** | Simple issue |
| **state** | new |
| **type** | - |
| **labels** | - |
Expand Down
29 changes: 14 additions & 15 deletions tests/includes/show_metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@

## Meta Data

| **field** | **value** |
| ----------------- | -------------------------- |
| **id** | 1 |
| **title** | Very important new feature |
| **state** | active |
| **type** | feature |
| **labels** | ui,driver |
| **reporter** | alice |
| **assignee** | bob |
| **priority** | P1 |
| **due_date** | 2026-06-24 |
| **relationships** | related: 2 |
| | child: 2, 3 |
| **created** | __CREATED__ |
| **updated** | __UPDATED__ |
| **field** | **value** |
| ----------------- | -------------------- |
| **id** | 1 |
| **state** | active |
| **type** | feature |
| **labels** | ui,driver |
| **reporter** | alice |
| **assignee** | bob |
| **priority** | P1 |
| **due_date** | 2026-06-24 |
| **relationships** | related: 2 |
| | child: 2, 3 |
| **created** | __CREATED__ |
| **updated** | __UPDATED__ |

## Description

Expand Down
30 changes: 30 additions & 0 deletions tests/includes/show_metadata_wider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!-- READ-ONLY VIEW -->

# Issue #1 -- Very important new feature

## Meta Data

| **field** | **value** |
| ----------------- | ------------------------------------------ |
| **id** | 1 |
| **state** | active |
| **type** | feature |
| **labels** | ui,driver,backend,api,performance,security |
| **reporter** | alice |
| **assignee** | bob |
| **priority** | P1 |
| **due_date** | 2026-06-24 |
| **relationships** | related: 2 |
| | child: 2, 3 |
| **created** | __CREATED__ |
| **updated** | __UPDATED__ |

## Description

### Description

### Repro Steps

### Expected Behavior

### System Info
52 changes: 52 additions & 0 deletions tests/show_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,55 @@ fn test_show_metadata() {

assert!((stdout_str == expected) || (stdout_str == expected_updated_plus_1) || (stdout_str == expected_both_plus_1));
}

#[test]
fn test_show_metadata_wider() {
let _env = TestEnv::new();

run_command(&["init", "--no-commit"]).expect("init failed");
disable_auto_commit();

// Change settings: Set 'editor' to 'cat' resp. 'cat'-equivalent
let editor = if cfg!(windows) { "type" } else { "cat" };
let settings_path = ".gitissues/settings.yaml";
let mut settings = load_yaml_values(settings_path);
settings["editor"] = serde_yaml::Value::String(editor.to_string());
save_yaml_values(settings_path, &settings);

// Current time
let t = Utc::now();
let now = t.format("%Y-%m-%dT%H:%M:%SZ").to_string();
let now_plus_1s = (t + Duration::from_secs(1)).format("%Y-%m-%dT%H:%M:%SZ").to_string();

// Create new issue
run_command(&["new", "Very important new feature"]).expect("new failed");
run_command(&["new", "Issue 2"]).expect("new failed");
run_command(&["new", "Issue 3"]).expect("new failed");

// Set some metadata with wider values (a lot of labels)
run_command(&["set", "1", "--state", "active"]).expect("set failed");
run_command(&["set", "1", "--type", "feature"]).expect("set failed");
run_command(&["set", "1", "--priority", "P1"]).expect("set failed");
run_command(&["set", "1", "--labels", "ui,driver,backend,api,performance,security"]).expect("set failed");
run_command(&["set", "1", "--reporter", "alice"]).expect("set failed");
run_command(&["set", "1", "--assignee", "bob"]).expect("set failed");
run_command(&["set", "1", "--due_date", "2026-06-24"]).expect("set failed");
run_command(&["link", "1", "--add", "related=2"]).expect("set failed");
run_command(&["link", "1", "--add", "child=2,3"]).expect("set failed");

// expected
let expected_template = include_str!("includes/show_metadata_wider.md").replace("\r\n", "\n");

let expected = expected_template.replace("__CREATED__", &now).replace("__UPDATED__", &now);
let expected_updated_plus_1 = expected_template.replace("__CREATED__", &now).replace("__UPDATED__", &now_plus_1s);
let expected_both_plus_1 = expected_template
.replace("__CREATED__", &now_plus_1s)
.replace("__UPDATED__", &now_plus_1s);

// stdout
let output = run_command(&["show", "1"]).expect("show failed");
let stdout = String::from_utf8_lossy(&output.stdout);
let stdout_str = stdout.as_ref().replace("\r\n", "\n");

assert!((stdout_str == expected) || (stdout_str == expected_updated_plus_1) || (stdout_str == expected_both_plus_1));
}