Skip to content

Commit e3c45f4

Browse files
committed
Don't report types for pulls
1 parent 15fc1c8 commit e3c45f4

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/cmd/lib/pull.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export const pullCmd = new Command()
5151
headerText: "Changes that would be pulled:",
5252
summaryPrefix: "Would pull:",
5353
emptyMessage: "No changes to pull",
54+
includeTypes: false,
5455
includeSummary: true,
5556
});
5657
console.log();

src/cmd/lib/utils.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,20 @@ export function getVersionRangeStr(
6464
export function formatStatus(
6565
path: string,
6666
status: keyof FileState,
67-
type: ProjectItemType,
68-
maxTypeLength: number,
67+
type?: ProjectItemType,
68+
maxTypeLength: number = 0,
6969
): string {
7070
// Get color configuration for the status or use default
7171
const config = STATUS_STYLES[status];
7272

73+
// Get the base status text
74+
const baseStatusText = config.color(config.prefix) + " ";
75+
76+
// If type is empty or undefined, don't include type indicator
77+
if (!type) {
78+
return baseStatusText + path;
79+
}
80+
7381
// Extract file type with consistent padding
7482
const paddedFileType = type.padEnd(maxTypeLength);
7583

@@ -79,9 +87,6 @@ export function formatStatus(
7987
const typeEnd = colors.gray(")");
8088
const typeIndicator = typeStart + typeContent + typeEnd;
8189

82-
// Get the base status text
83-
const baseStatusText = config.color(config.prefix) + " ";
84-
8590
// Combine the status prefix, type indicator, and path
8691
return baseStatusText + typeIndicator + " " + path;
8792
}
@@ -96,6 +101,7 @@ export function formatStatus(
96101
* @param options.summaryPrefix - Text to show before the summary (default: "Changes:")
97102
* @param options.emptyMessage - Message to show when there are no changes (default: "No changes")
98103
* @param options.includeSummary - Whether to display the summary (default: true)
104+
* @param options.includeTypes - Whether to display the (detected) types of the files (default: true)
99105
* @returns The total number of changes
100106
*/
101107
export function displayFileStateChanges(
@@ -106,6 +112,7 @@ export function displayFileStateChanges(
106112
summaryPrefix?: string;
107113
emptyMessage?: string;
108114
includeSummary?: boolean;
115+
includeTypes?: boolean;
109116
} = {},
110117
): void {
111118
const {
@@ -114,6 +121,7 @@ export function displayFileStateChanges(
114121
summaryPrefix = "Local Changes:",
115122
emptyMessage = "No local changes. Local working tree clean.",
116123
includeSummary = true,
124+
includeTypes = true,
117125
} = options;
118126
const totalChanges = fileStateChanges.changes();
119127

@@ -134,7 +142,13 @@ export function displayFileStateChanges(
134142
if (type !== "not_modified") {
135143
for (const file of files) {
136144
console.log(
137-
" " + formatStatus(file.path, file.status, file.type, maxTypeLength),
145+
" " +
146+
formatStatus(
147+
file.path,
148+
file.status,
149+
includeTypes ? file.type : undefined,
150+
maxTypeLength,
151+
),
138152
);
139153
}
140154
}

0 commit comments

Comments
 (0)