@@ -61,18 +61,25 @@ const std::map<git_status_t, status_messages> status_msg_map = //TODO : check
6161 { GIT_STATUS_CONFLICTED, {" " , " " } },
6262};
6363
64- void print_entries (git_status_t status, status_list_wrapper& sl, bool head_selector, size_t output_format) // TODO: add different mods
64+ enum class output_format
65+ {
66+ DEFAULT = 0 ,
67+ LONG = 1 ,
68+ SHORT = 2
69+ };
70+
71+ void print_entries (git_status_t status, status_list_wrapper& sl, bool head_selector, output_format of) // TODO: add different mods
6572{
6673 const auto & entry_list = sl.get_entry_list (status);
6774 if (!entry_list.empty ())
6875 {
6976 for (auto * entry : entry_list)
7077 {
71- if ((output_format <= 1 ))
78+ if ((of == output_format::DEFAULT) || (of == output_format::LONG ))
7279 {
7380 std::cout << status_msg_map.at (status).long_mod << " \t " ;
7481 }
75- else if (output_format == 2 )
82+ else if (of == output_format::SHORT )
7683 {
7784 std::cout << status_msg_map.at (status).short_mod ;
7885 }
@@ -118,14 +125,14 @@ void status_subcommand::run()
118125
119126 // TODO: add branch info
120127
121- size_t output_format = 0 ;
128+ output_format of = output_format::DEFAULT ;
122129 if (short_flag)
123130 {
124- output_format = 2 ;
131+ of = output_format::SHORT ;
125132 }
126133 if (long_flag)
127134 {
128- output_format = 1 ;
135+ of = output_format::LONG ;
129136 }
130137 // else if (porcelain_format)
131138 // {
@@ -135,35 +142,35 @@ void status_subcommand::run()
135142 if (sl.has_tobecommited_header ())
136143 {
137144 std::cout << tobecommited_header << std::endl;
138- print_entries (GIT_STATUS_INDEX_NEW, sl, true , output_format );
139- print_entries (GIT_STATUS_INDEX_MODIFIED, sl, true , output_format );
140- print_entries (GIT_STATUS_INDEX_DELETED, sl, true , output_format );
141- print_entries (GIT_STATUS_INDEX_RENAMED, sl, true , output_format );
142- print_entries (GIT_STATUS_INDEX_TYPECHANGE, sl, true , output_format );
145+ print_entries (GIT_STATUS_INDEX_NEW, sl, true , of );
146+ print_entries (GIT_STATUS_INDEX_MODIFIED, sl, true , of );
147+ print_entries (GIT_STATUS_INDEX_DELETED, sl, true , of );
148+ print_entries (GIT_STATUS_INDEX_RENAMED, sl, true , of );
149+ print_entries (GIT_STATUS_INDEX_TYPECHANGE, sl, true , of );
143150 std::cout << std::endl;
144151 }
145152
146153 if (sl.has_notstagged_header ())
147154 {
148155 std::cout << notstagged_header << std::endl;
149- print_entries (GIT_STATUS_WT_MODIFIED, sl, false , output_format );
150- print_entries (GIT_STATUS_WT_DELETED, sl, false , output_format );
151- print_entries (GIT_STATUS_WT_TYPECHANGE, sl, false , output_format );
152- print_entries (GIT_STATUS_WT_RENAMED, sl, false , output_format );
156+ print_entries (GIT_STATUS_WT_MODIFIED, sl, false , of );
157+ print_entries (GIT_STATUS_WT_DELETED, sl, false , of );
158+ print_entries (GIT_STATUS_WT_TYPECHANGE, sl, false , of );
159+ print_entries (GIT_STATUS_WT_RENAMED, sl, false , of );
153160 std::cout << std::endl;
154161 }
155162
156163 if (sl.has_untracked_header ())
157164 {
158165 std::cout << untracked_header << std::endl;
159- print_entries (GIT_STATUS_WT_NEW, sl, false , output_format );
166+ print_entries (GIT_STATUS_WT_NEW, sl, false , of );
160167 std::cout << std::endl;
161168 }
162169
163170 if (sl.has_ignored_header ())
164171 {
165172 std::cout << ignored_header << std::endl;
166- print_entries (GIT_STATUS_IGNORED, sl, false , output_format );
173+ print_entries (GIT_STATUS_IGNORED, sl, false , of );
167174 std::cout << std::endl;
168175 }
169176}
0 commit comments