Skip to content

Commit b9371fc

Browse files
committed
remove flag options
Not providing the --keep-metadata flag is useless and the flag-options are not useful, until there aren't more options implemented -> default always provide --keep-metadata
1 parent 62c8c15 commit b9371fc

File tree

4 files changed

+15
-43
lines changed

4 files changed

+15
-43
lines changed

src/core/OSTreeTUI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ int OSTreeTUI::main(const std::string& repo, const std::vector<std::string>& sta
130130
ostree_repo.promoteCommit(visible_commit_view_map.at(selected_commit),
131131
ostree_repo.getBranches().at(static_cast<size_t>(promotionManager.branch_selected)),
132132
{}, promotionManager.new_subject,
133-
promotionManager.options_state[0]);
133+
true);
134134
refresh_repository();
135135
notification_text = " Applied content promotion. ";
136136
}, ButtonOption::Simple()));

src/core/manager.cpp

+13-31
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ ContentPromotionManager::ContentPromotionManager(bool show_tooltips): show_toolt
9494
using namespace ftxui;
9595

9696
subject_component = Input(&new_subject, "subject");
97-
98-
flags = Container::Vertical({
99-
Checkbox(&options_label[0], &options_state[0]),
100-
});
10197
}
10298

10399
void ContentPromotionManager::setBranchRadiobox(ftxui::Component radiobox) {
@@ -106,7 +102,7 @@ void ContentPromotionManager::setBranchRadiobox(ftxui::Component radiobox) {
106102
branch_selection = CatchEvent(radiobox, [&](const Event& event) {
107103
// copy commit id
108104
if (event == Event::Return) {
109-
flags->TakeFocus();
105+
subject_component->TakeFocus();
110106
}
111107
return false;
112108
});
@@ -126,14 +122,8 @@ ftxui::Elements ContentPromotionManager::renderPromotionCommand(cpplibostree::OS
126122
line.push_back(text("ostree commit") | bold);
127123
line.push_back(text(" --repo=" + ostree_repo.getRepoPath()) | bold);
128124
line.push_back(text(" -b " + ostree_repo.getBranches().at(static_cast<size_t>(branch_selected))) | bold);
129-
// flags
130-
for (size_t i = 0; i < 8; ++i) {
131-
if (options_state[i]) {
132-
line.push_back(text(" "));
133-
line.push_back(text(options_label[i]) | dim);
134-
}
135-
}
136-
// optional subject
125+
line.push_back(text(" --keep-metadata") | bold);
126+
// optional subject
137127
if (!new_subject.empty()) {
138128
line.push_back(text(" -s \"") | bold);
139129
line.push_back(text(new_subject) | color(Color::BlueLight) | bold);
@@ -150,13 +140,10 @@ ftxui::Component ContentPromotionManager::composePromotionComponent() {
150140

151141
return Container::Vertical({
152142
branch_selection,
153-
Container::Horizontal({
154-
flags,
155-
Container::Vertical({
156-
subject_component,
157-
apply_button,
158-
}),
159-
}),
143+
Container::Vertical({
144+
subject_component,
145+
apply_button,
146+
}),
160147
});
161148
}
162149

@@ -181,7 +168,6 @@ ftxui::Element ContentPromotionManager::renderPromotionView(cpplibostree::OSTree
181168
// build elements
182169
auto commit_hash = vbox({text(" Commit: ") | bold | color(Color::Green), text(" " + display_commit.hash)}) | flex;
183170
auto branch_win = window(text("New Branch"), branch_selection->Render() | vscroll_indicator | frame);
184-
auto flags_win = window(text("Flags"), flags->Render() | vscroll_indicator | frame);
185171
auto subject_win = window(text("Subject"), subject_component->Render()) | flex;
186172
auto aButton_win = apply_button->Render() | color(Color::Green) | size(WIDTH, GREATER_THAN, 9) | flex;
187173

@@ -193,22 +179,18 @@ ftxui::Element ContentPromotionManager::renderPromotionView(cpplibostree::OSTree
193179
};
194180
auto tool_tips_win = !show_tooltips || tooltips_win_height < 2 ? filler() : // only show if screen is reasonable size
195181
branch_selection->Focused() ? toolTipContent(0) :
196-
flags->Focused() ? toolTipContent(1) :
197-
subject_component->Focused() ? toolTipContent(2) :
198-
apply_button->Focused() ? toolTipContent(3) :
182+
subject_component->Focused() ? toolTipContent(1) :
183+
apply_button->Focused() ? toolTipContent(2) :
199184
filler();
200185

201186
// build element composition
202187
return vbox({
203188
commit_hash | size(HEIGHT, EQUAL, commit_win_height),
204189
branch_win | size(HEIGHT, LESS_THAN, branch_select_win_height),
205-
hbox({
206-
flags_win,
207-
vbox({
208-
subject_win,
209-
aButton_win,
210-
}) | flex,
211-
}) | size(HEIGHT, LESS_THAN, apsect_win_height),
190+
vbox({
191+
subject_win,
192+
aButton_win,
193+
}) | flex | size(HEIGHT, LESS_THAN, apsect_win_height),
212194
hflow(renderPromotionCommand(ostree_repo, display_commit.hash)) | flex_grow,
213195
filler(),
214196
tool_tips_win,

src/core/manager.hpp

-10
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,6 @@ class ContentPromotionManager {
6565
ftxui::Component branch_selection; // must be set from OSTreeTUI
6666
int branch_selected{0};
6767

68-
// flag selection
69-
ftxui::Component flags;
70-
71-
const std::array<std::string, 8> options_label = {
72-
"--keep-metadata",
73-
};
74-
std::array<bool, 8> options_state = {
75-
false,
76-
};
77-
7868
// subject
7969
ftxui::Component subject_component;
8070

src/util/cpplibostree.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ namespace cpplibostree {
149149
* @return true on success
150150
* @return false on failed promotion
151151
*/
152-
bool promoteCommit(const std::string& hash, const std::string& newRef, const std::vector<std::string> addMetadataStrings, const std::string& newSubject = "", bool keepMetadata = false);
152+
bool promoteCommit(const std::string& hash, const std::string& newRef, const std::vector<std::string> addMetadataStrings, const std::string& newSubject = "", bool keepMetadata = true);
153153

154154
private:
155155
/**

0 commit comments

Comments
 (0)