Skip to content

Commit 6d0a2ec

Browse files
authored
Minimal docs at module level (#2639)
1 parent 950e703 commit 6d0a2ec

File tree

6 files changed

+97
-5
lines changed

6 files changed

+97
-5
lines changed

asyncgit/src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
//! asyncgit
1+
/*!
2+
`AsyncGit` is a library that provides non-blocking access to Git
3+
operations, enabling `GitUI` to perform potentially slow Git operations
4+
in the background while keeping the user interface responsive.
5+
6+
It also provides synchronous Git operations.
7+
8+
It wraps libraries like git2 and gix.
9+
*/
210

311
#![forbid(missing_docs)]
412
#![deny(

asyncgit/src/sync/remotes/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn get_current_branch(
132132

133133
/// Tries to find the default repo to fetch from based on configuration.
134134
///
135-
/// > branch.<name>.remote
135+
/// > `branch.<name>.remote`
136136
/// >
137137
/// > When on branch `<name>`, it tells `git fetch` and `git push` which remote to fetch from or
138138
/// > push to. [...] If no remote is configured, or if you are not on any branch and there is more
@@ -173,12 +173,12 @@ pub(crate) fn get_default_remote_for_fetch_in_repo(
173173

174174
/// Tries to find the default repo to push to based on configuration.
175175
///
176-
/// > remote.pushDefault
176+
/// > `remote.pushDefault`
177177
/// >
178178
/// > The remote to push to by default. Overrides `branch.<name>.remote` for all branches, and is
179179
/// > overridden by `branch.<name>.pushRemote` for specific branches.
180180
///
181-
/// > branch.<name>.remote
181+
/// > `branch.<name>.remote`
182182
/// >
183183
/// > When on branch `<name>`, it tells `git fetch` and `git push` which remote to fetch from or
184184
/// > push to. The remote to push to may be overridden with `remote.pushDefault` (for all

asyncgit/src/sync/sign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ pub struct SSHSign {
281281
}
282282

283283
impl SSHSign {
284-
/// Create new [`SSHDiskKeySign`] for sign.
284+
/// Create new `SSHDiskKeySign` for sign.
285285
pub fn new(mut key: PathBuf) -> Result<Self, SignBuilderError> {
286286
key.set_extension("");
287287
if key.is_file() {

src/components/mod.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
/*!
2+
Components are the visible building blocks in gitui.
3+
4+
They have a state, handle events, and render to the terminal:
5+
6+
* Some are full screen. That would be all the [`tabs`](super::tabs).
7+
* Some look like panels, eg [`CommitDetailsComponent`]
8+
* Some overlap others. They are collected in module [`popups`](super::popups)
9+
* Some are decorations, eg [`HorizontalScroll`](utils::scroll_horizontal::HorizontalScroll).
10+
11+
Components can be reused.
12+
For example, [`CommitList`] is used in both tab "revlog" and tab "stashlist".
13+
14+
15+
## Composition
16+
17+
In gitui, composition is driven by code. This means each component must
18+
have code that explicitly forwards component function calls like draw,
19+
commands and event to the components it is composed of.
20+
21+
Other systems use composition by data: They provide a generic data structure
22+
that reflects the visual hierarchy, and uses it at runtime to
23+
determine which code should be executed. This is not how gitui works.
24+
25+
## Traits
26+
27+
There are two traits defined here:
28+
* [`Component`] handles events from the user,
29+
* [`DrawableComponent`] renders to the terminal.
30+
31+
In the current codebase these are always implemented together, and it probably
32+
makes more sense to merge them some time in the future.
33+
It is a little strange that you implement `draw()` on a `DrawableComponent`,
34+
but have function `hide()` from trait Component which does not know how
35+
to `draw()`.
36+
*/
37+
138
mod changes;
239
mod command;
340
mod commit_details;

src/main.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
//!
2+
//! The gitui program is a text-based UI for working with a Git repository.
3+
//! The main navigation occurs between a number of tabs.
4+
//! When you execute commands, the program may use popups to communicate
5+
//! with the user. It is possible to customize the keybindings.
6+
//!
7+
//!
8+
//! ## Internal Modules
9+
//! The top-level modules of gitui can be grouped as follows:
10+
//!
11+
//! - User Interface
12+
//! - [tabs] for main navigation
13+
//! - [components] for visual elements used on tabs
14+
//! - [popups] for temporary dialogs
15+
//! - [ui] for tooling like scrollbars
16+
//! - Git Interface
17+
//! - [asyncgit] (crate) for async operations on repository
18+
//! - Distribution and Documentation
19+
//! - Project files
20+
//! - Github CI
21+
//! - Installation files
22+
//! - Usage guides
23+
//!
24+
//! ## Included Crates
25+
//! Some crates are part of the gitui repository:
26+
//! - [asyncgit] for Git operations in the background.
27+
//! - git2-hooks (used by asyncgit).
28+
//! - git2-testing (used by git2-hooks).
29+
//! - invalidstring used by asyncgit for testing with invalid strings.
30+
//! - [filetreelist] for a tree view of files.
31+
//! - [scopetime] for measuring execution time.
32+
//!
33+
134
#![forbid(unsafe_code)]
235
#![deny(
336
unused_imports,

src/tabs/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/*!
2+
The tabs module contains a struct for each of the tabs visible in the
3+
ui:
4+
5+
- [`Status`]: Stage changes, push, pull
6+
- [`Revlog`]: Revision log (think git log)
7+
- [`FilesTab`]: See content of any file at HEAD. Blame
8+
- [`Stashing`]: Managing one stash
9+
- [`StashList`]: Managing all stashes
10+
11+
Many of the tabs can expand to show more details. This is done via
12+
Enter or right-arrow. To close again, press ESC.
13+
*/
14+
115
mod files;
216
mod revlog;
317
mod stashing;

0 commit comments

Comments
 (0)