refactor(notes): remove csv and jsonl output formats
Remove print_list_notes_csv, print_list_notes_jsonl, and csv_escape from the notes list command. The --format flag's csv and jsonl variants added complexity without meaningful adoption — robot mode already provides structured JSON output. Notes now have two output paths: human (default) and JSON (--robot). Also removes the corresponding test coverage (csv_escape, csv_output). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1269,60 +1269,6 @@ fn test_truncate_note_body() {
|
||||
assert!(result.ends_with("..."));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_csv_escape_basic() {
|
||||
assert_eq!(csv_escape("simple"), "simple");
|
||||
assert_eq!(csv_escape("has,comma"), "\"has,comma\"");
|
||||
assert_eq!(csv_escape("has\"quote"), "\"has\"\"quote\"");
|
||||
assert_eq!(csv_escape("has\nnewline"), "\"has\nnewline\"");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_csv_output_basic() {
|
||||
let result = NoteListResult {
|
||||
notes: vec![NoteListRow {
|
||||
id: 1,
|
||||
gitlab_id: 100,
|
||||
author_username: "alice".to_string(),
|
||||
body: Some("Hello, world".to_string()),
|
||||
note_type: Some("DiffNote".to_string()),
|
||||
is_system: false,
|
||||
created_at: 1_000_000,
|
||||
updated_at: 2_000_000,
|
||||
position_new_path: Some("src/main.rs".to_string()),
|
||||
position_new_line: Some(42),
|
||||
position_old_path: None,
|
||||
position_old_line: None,
|
||||
resolvable: true,
|
||||
resolved: false,
|
||||
resolved_by: None,
|
||||
noteable_type: Some("Issue".to_string()),
|
||||
parent_iid: Some(7),
|
||||
parent_title: Some("Test issue".to_string()),
|
||||
project_path: "group/project".to_string(),
|
||||
}],
|
||||
total_count: 1,
|
||||
};
|
||||
|
||||
// Verify csv_escape handles the comma in body correctly
|
||||
let body = result.notes[0].body.as_deref().unwrap();
|
||||
let escaped = csv_escape(body);
|
||||
assert_eq!(escaped, "\"Hello, world\"");
|
||||
|
||||
// Verify the formatting helpers
|
||||
assert_eq!(
|
||||
format_note_type(result.notes[0].note_type.as_deref()),
|
||||
"Diff"
|
||||
);
|
||||
assert_eq!(
|
||||
format_note_parent(
|
||||
result.notes[0].noteable_type.as_deref(),
|
||||
result.notes[0].parent_iid,
|
||||
),
|
||||
"Issue #7"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_jsonl_output_one_per_line() {
|
||||
let result = NoteListResult {
|
||||
|
||||
Reference in New Issue
Block a user