generated from ArthurSonzogni/ftxui-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add generic git commands to git-tui command (#18)
Add generic git commands to git-tui command Co-authored-by: ArthurSonzogni <[email protected]>
- Loading branch information
1 parent
c8c6443
commit 6bb67b4
Showing
12 changed files
with
134 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "git.hpp" | ||
|
||
#include <string> // for string, allocator, basic_string | ||
#include <utility> // for move | ||
#include <vector> // for vector | ||
|
||
#include "subprocess/ProcessBuilder.hpp" // for run | ||
#include "subprocess/basic_types.hpp" // for CompletedProcess | ||
|
||
namespace gittui::git { | ||
int main(int argc, const char** argv) { | ||
std::vector<std::string> args = { | ||
"git", | ||
}; | ||
|
||
for (int i = 0; i < argc; ++i) | ||
args.push_back(argv[i]); | ||
|
||
return subprocess::run(std::move(args)).returncode; | ||
} | ||
} // namespace gittui::git | ||
|
||
// Copyright 2024 Arthur Sonzogni. All rights reserved. | ||
// Use of this source code is governed by the MIT license that can be found in | ||
// the LICENSE file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef GIT_TUI_GIT_HPP | ||
#define GIT_TUI_GIT_HPP | ||
|
||
namespace gittui::git { | ||
int main(int argc, const char** argv); | ||
} // namespace gittui::git | ||
|
||
#endif /* end of include guard: GIT_TUI_GIT_HPP */ | ||
|
||
// Copyright 2024 Arthur Sonzogni. All rights reserved. | ||
// Use of this source code is governed by the MIT license that can be found in | ||
// the LICENSE file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
#ifndef GIT_TUI_SIMPLE_BUTTOn_OPTION | ||
#define GIT_TUI_SIMPLE_BUTTOn_OPTION | ||
#ifndef GIT_TUI_SIMPLE_BUTTOn_OPTION | ||
#define GIT_TUI_SIMPLE_BUTTOn_OPTION | ||
|
||
#include <ftxui/component/component_options.hpp> | ||
#include <ftxui/dom/elements.hpp> | ||
|
||
namespace gittui{ | ||
using namespace ftxui; | ||
/// when focused. This is the current default. | ||
static ButtonOption SimpleButtonOption() { | ||
ButtonOption option; | ||
option.transform = [](const EntryState& s) { | ||
auto element = text(s.label); | ||
if (s.active) { | ||
element |= bold; | ||
} | ||
if (s.focused) { | ||
element |= inverted; | ||
} | ||
return element; | ||
}; | ||
return option; | ||
} | ||
namespace gittui { | ||
using namespace ftxui; | ||
/// when focused. This is the current default. | ||
static ButtonOption SimpleButtonOption() { | ||
ButtonOption option; | ||
option.transform = [](const EntryState& s) { | ||
auto element = text(s.label); | ||
if (s.active) { | ||
element |= bold; | ||
} | ||
if (s.focused) { | ||
element |= inverted; | ||
} | ||
return element; | ||
}; | ||
return option; | ||
} | ||
|
||
} // namespace | ||
} // namespace gittui | ||
|
||
#endif // GIT_TUI_SIMPLE_BUTTOn_OPTION | ||
#endif // GIT_TUI_SIMPLE_BUTTOn_OPTION | ||
|
||
// Copyright 2021 Arthur Sonzogni. All rights reserved. | ||
// Use of this source code is governed by the MIT license that can be found in | ||
// the LICENSE file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters