Skip to content

Commit

Permalink
Update usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurSonzogni committed May 24, 2021
1 parent fb5e86c commit 13f7d78
Show file tree
Hide file tree
Showing 11 changed files with 821 additions and 894 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ add_executable(git-tui
src/diff.hpp
src/log.cpp
src/log.hpp
src/help.cpp
src/help.hpp
src/version.cpp
src/version.hpp
src/main.cpp
src/scroller.cpp
src/scroller.hpp
Expand Down
12 changes: 6 additions & 6 deletions src/diff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
#include <assert.h> // for assert
#include <stdlib.h> // for EXIT_SUCCESS
#include <ftxui/screen/string.hpp> // for to_wstring
#include <iostream> // for operator<<, stringstream, endl, basic_ios, basic_istream, basic_ostream, cout, ostream
#include <iostream> // for basic_istream, operator<<, stringstream, endl, basic_ios, basic_ostream, cout, ostream
#include <iterator> // for istreambuf_iterator, operator!=
#include <memory> // for allocator_traits<>::value_type, shared_ptr, __shared_ptr_access
#include <regex> // for regex_match, match_results, match_results<>::_Base_type, sub_match, regex, smatch
#include <string> // for wstring, allocator, operator+, basic_string, char_traits, string, stoi, getline, to_string
#include <string> // for wstring, operator+, allocator, basic_string, char_traits, string, stoi, getline, to_string
#include <utility> // for move
#include <vector> // for vector

#include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Renderer, Button, Horizontal, CatchEvent, Checkbox, Menu, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/event.hpp" // for Event
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for text, operator|, vbox, separator, Element, Elements, filler, bgcolor, size, window, xflex, color, hbox, dim, EQUAL, WIDTH, xflex_grow, xflex_shrink, yflex
#include "ftxui/screen/color.hpp" // for Color, Color::Black, Color::White
#include "process.hpp"
#include "scroller.hpp" // for Scroller
#include "process.hpp" // for process
#include "scroller.hpp" // for Scroller

using namespace ftxui;

Expand Down Expand Up @@ -226,7 +226,7 @@ int main(int argc, const char** argv) {
procxx::process git("git");
git.add_argument("diff");
git.add_argument("-U" + std::to_string(hunk_size));
for(int i = 0; i<argc; ++i)
for (int i = 0; i < argc; ++i)
git.add_argument(argv[i]);
git.exec();

Expand Down
8 changes: 5 additions & 3 deletions src/diff.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#ifndef GIT_DIFF_TUI_DIFF_HPP
#define GIT_DIFF_TUI_DIFF_HPP

#include <string>
#include <vector>
#include <ftxui/dom/elements.hpp>
#include <ftxui/dom/elements.hpp> // for Element
#include <string> // for wstring, string
#include <vector> // for vector

#include "ftxui/screen/box.hpp" // for ftxui

namespace diff {
using namespace ftxui;
Expand Down
20 changes: 20 additions & 0 deletions src/help.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "help.hpp"

#include <stdlib.h> // for EXIT_SUCCESS
#include <iostream> // for operator<<, endl, basic_ostream, cout, ostream

namespace help {
int main(int argc, const char** argv) {
(void)argc;
(void)argv;
std::cout << "Usage: " << std::endl;
std::cout << " - git tui diff [args]*" << std::endl;
std::cout << " - git tui log [args]*" << std::endl;
std::cout << "" << std::endl;
return EXIT_SUCCESS;
}
} // namespace help

// 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.
12 changes: 12 additions & 0 deletions src/help.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef GIT_TUI_HELP_HPP
#define GIT_TUI_HELP_HPP

namespace help {
int main(int argc, const char** argv);
}

#endif /* end of include guard: GIT_TUI_HELP_HPP */

// 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.
45 changes: 31 additions & 14 deletions src/log.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
#include "log.hpp"
#include <ftxui/component/component.hpp>
#include <ftxui/component/menu.hpp>
#include <ftxui/component/screen_interactive.hpp>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include "diff.hpp"
#include "process.hpp"
#include "scroller.hpp"

#include <stdlib.h> // for EXIT_SUCCESS
#include <algorithm> // for copy
#include <ftxui/component/component.hpp> // for Horizontal, Renderer, Button, Menu, CatchEvent, Checkbox, Vertical
#include <ftxui/component/menu.hpp> // for MenuBase
#include <ftxui/component/screen_interactive.hpp> // for ScreenInteractive
#include <ftxui/dom/elements.hpp> // for operator|, text, separator, Element, size, xflex, vbox, color, yframe, hbox, bold, EQUAL, WIDTH, filler, Elements, nothing, yflex, bgcolor
#include <ftxui/screen/string.hpp> // for to_wstring, to_string
#include <functional> // for function
#include <iostream> // for basic_istream, char_traits
#include <iterator> // for istreambuf_iterator, operator!=
#include <map> // for map, map<>::mapped_type
#include <memory> // for allocator, shared_ptr, __shared_ptr_access, unique_ptr, make_unique
#include <queue> // for queue
#include <string> // for wstring, basic_string, string, getline, operator+, operator<, to_string
#include <utility> // for move
#include <vector> // for vector

#include "diff.hpp" // for File, Parse, Render
#include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/event.hpp" // for Event
#include "ftxui/screen/color.hpp" // for Color, Color::Green, Color::Red, Color::Black, Color::White
#include "process.hpp" // for process
#include "scroller.hpp" // for Scroller

using namespace ftxui;
namespace log {
Expand Down Expand Up @@ -178,7 +191,6 @@ int main(int argc, const char** argv) {
}));
}


elements.push_back(hbox({
text(L" hash:") | bold | color(Color::Green),
text(commit->hash) | xflex,
Expand Down Expand Up @@ -265,7 +277,8 @@ int main(int argc, const char** argv) {
separator(),
scroller->Render() | xflex,
}) | xflex,
}) | yflex | nothing,
}) | yflex |
nothing,
});
});

Expand Down Expand Up @@ -298,3 +311,7 @@ int main(int argc, const char** argv) {
}

} // namespace log

// 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.
4 changes: 4 additions & 0 deletions src/log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ int main(int argc, const char** argv);
}

#endif /* end of include guard: GIT_TUI_LOG_HPP */

// 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.
34 changes: 5 additions & 29 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,33 +1,9 @@
#include <stdlib.h> // for EXIT_SUCCESS
#include <iostream> // for operator<<, endl, basic_ostream, cout, ostream
#include <string> // for operator==, allocator, basic_string, string
#include <string> // for operator==, allocator, basic_string, string

#include "diff.hpp" // for diff
#include "log.hpp" // for diff
#include "environment.h" // for project_version
#include "ftxui/component/captured_mouse.hpp" // for ftxui

using namespace ftxui;

namespace help {
int main(int argc, const char** argv) {
(void)argc;
(void)argv;
std::cout << "Usage: " << std::endl;
std::cout << " - git tui diff [args]*" << std::endl;
std::cout << "" << std::endl;
return EXIT_SUCCESS;
}
} // namespace help

namespace version {
int main(int argc, const char** argv) {
(void)argc;
(void)argv;
std::cout << project_version << std::endl;
return EXIT_SUCCESS;
}
} // namespace version
#include "diff.hpp" // for main
#include "help.hpp" // for main
#include "log.hpp" // for main
#include "version.hpp" // for main

int main(int argc, const char** argv) {
if (argc == 0)
Expand Down
Loading

0 comments on commit 13f7d78

Please sign in to comment.