@@ -64,12 +64,20 @@ export function getVersionRangeStr(
64
64
export function formatStatus (
65
65
path : string ,
66
66
status : keyof FileState ,
67
- type : ProjectItemType ,
68
- maxTypeLength : number ,
67
+ type ? : ProjectItemType ,
68
+ maxTypeLength : number = 0 ,
69
69
) : string {
70
70
// Get color configuration for the status or use default
71
71
const config = STATUS_STYLES [ status ] ;
72
72
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
+
73
81
// Extract file type with consistent padding
74
82
const paddedFileType = type . padEnd ( maxTypeLength ) ;
75
83
@@ -79,9 +87,6 @@ export function formatStatus(
79
87
const typeEnd = colors . gray ( ")" ) ;
80
88
const typeIndicator = typeStart + typeContent + typeEnd ;
81
89
82
- // Get the base status text
83
- const baseStatusText = config . color ( config . prefix ) + " " ;
84
-
85
90
// Combine the status prefix, type indicator, and path
86
91
return baseStatusText + typeIndicator + " " + path ;
87
92
}
@@ -96,6 +101,7 @@ export function formatStatus(
96
101
* @param options.summaryPrefix - Text to show before the summary (default: "Changes:")
97
102
* @param options.emptyMessage - Message to show when there are no changes (default: "No changes")
98
103
* @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)
99
105
* @returns The total number of changes
100
106
*/
101
107
export function displayFileStateChanges (
@@ -106,6 +112,7 @@ export function displayFileStateChanges(
106
112
summaryPrefix ?: string ;
107
113
emptyMessage ?: string ;
108
114
includeSummary ?: boolean ;
115
+ includeTypes ?: boolean ;
109
116
} = { } ,
110
117
) : void {
111
118
const {
@@ -114,6 +121,7 @@ export function displayFileStateChanges(
114
121
summaryPrefix = "Local Changes:" ,
115
122
emptyMessage = "No local changes. Local working tree clean." ,
116
123
includeSummary = true ,
124
+ includeTypes = true ,
117
125
} = options ;
118
126
const totalChanges = fileStateChanges . changes ( ) ;
119
127
@@ -134,7 +142,13 @@ export function displayFileStateChanges(
134
142
if ( type !== "not_modified" ) {
135
143
for ( const file of files ) {
136
144
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
+ ) ,
138
152
) ;
139
153
}
140
154
}
0 commit comments