File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,12 +22,22 @@ let ignore_size_warning_arg =
2222 let doc = " Ignore the minimum size warning." in
2323 Arg. (value & flag & info [ " i" ; " ignore-size-warning" ] ~doc )
2424
25- let run owner_repo local_path log_file ignore_size_warning =
26- Tui. start { owner_repo; local_path; log_file; ignore_size_warning }
25+ let no_nerd_font_arg =
26+ let doc = " Don't try to use Nerd Font Icons." in
27+ Arg. (value & flag & info [ " n" ; " no-nerd-font" ] ~doc )
28+
29+ let run owner_repo local_path log_file ignore_size_warning no_nerd_font =
30+ Tui. start
31+ { owner_repo; local_path; log_file; ignore_size_warning; no_nerd_font }
2732
2833let gh_tui_term =
2934 Term. (
30- const run $ owner_repo_arg $ path_arg $ log_arg $ ignore_size_warning_arg)
35+ const run
36+ $ owner_repo_arg
37+ $ path_arg
38+ $ log_arg
39+ $ ignore_size_warning_arg
40+ $ no_nerd_font_arg)
3141
3242let cmd =
3343 let doc = " TUI of a GitHub repository" in
Original file line number Diff line number Diff line change 33 (libraries
44 ansifmt
55 shell
6+ str
67 ;; Internal dependencies
78 extra))
Original file line number Diff line number Diff line change 1- let closed_char = " \u {ebda}"
2- let open_char = " \u {ea64}"
3- let merged_char = " \u {e725}"
4- let arrow_left_char = " \u {f0a8}"
5- let pwd_char = " \u {e5fd}"
6- let dir_char = " \u {f4d4}"
7- let empty_dir_char = " \u {f413}"
8- let file_char = " \u {f4a5}"
9- let bin_char = " \u {eae8}"
10- let warning = " \u {26A0}"
11- let issue_char = " \u {f41b}"
1+ type t = {
2+ closed_char : string ;
3+ open_char : string ;
4+ merged_char : string ;
5+ arrow_left_char : string ;
6+ pwd_char : string ;
7+ dir_char : string ;
8+ empty_dir_char : string ;
9+ file_char : string ;
10+ bin_char : string ;
11+ warning : string ;
12+ issue_char : string ;
13+ }
14+
15+ let get_icons no_nerd_font =
16+ if no_nerd_font = false then
17+ {
18+ closed_char = " \u {ebda}" ;
19+ open_char = " \u {ea64}" ;
20+ merged_char = " \u {e725}" ;
21+ arrow_left_char = " \u {f0a8}" ;
22+ pwd_char = " \u {e5fd}" ;
23+ dir_char = " \u {f4d4}" ;
24+ empty_dir_char = " \u {f413}" ;
25+ file_char = " \u {f4a5}" ;
26+ bin_char = " \u {eae8}" ;
27+ warning = " \u {26A0}" ;
28+ issue_char = " \u {f41b}" ;
29+ }
30+ else
31+ {
32+ closed_char = " x" ;
33+ open_char = " o" ;
34+ merged_char = " m" ;
35+ arrow_left_char = " <-" ;
36+ pwd_char = " *" ;
37+ dir_char = " /" ;
38+ empty_dir_char = " /" ;
39+ file_char = " f" ;
40+ bin_char = " b" ;
41+ warning = " !" ;
42+ issue_char = " i" ;
43+ }
Original file line number Diff line number Diff line change 1+ (* * A record representing the Icons and symbols used for identifying different
2+ parts. Symbols from Hack Nerd Font Mono are used when it's not explicitly
3+ disabled.
4+
5+ Symbols list:
6+
7+ - https://www.nerdfonts.com/cheat-sheet *)
8+ type t = {
9+ closed_char : string ;
10+ open_char : string ;
11+ merged_char : string ;
12+ arrow_left_char : string ;
13+ pwd_char : string ;
14+ dir_char : string ;
15+ empty_dir_char : string ;
16+ file_char : string ;
17+ bin_char : string ;
18+ warning : string ;
19+ issue_char : string ;
20+ }
21+
22+ (* Get the icon set - either nerd font or text icons *)
23+ val get_icons : bool -> t
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ module Layout = Layout
1515
1616(* * Icons and symbols used for identifying different parts. Symbols from Hack
1717 Nerd Font Mono are used when it's available. Symbols list:
18-
1918 - https://www.nerdfonts.com/cheat-sheet *)
2019module Icon = Icon
2120
Original file line number Diff line number Diff line change @@ -71,12 +71,14 @@ type t = {
7171 local_path : string option ;
7272 log_file : string option ;
7373 ignore_size_warning : bool ;
74+ no_nerd_font : bool ;
7475}
7576
76- let init { owner_repo; local_path; ignore_size_warning; log_file = _ } :
77- Model. initial_data =
77+ let init
78+ { owner_repo; local_path; ignore_size_warning; log_file = _ ; no_nerd_font }
79+ : Model.initial_data =
7880 let ({ owner; repo } as owner_repo) = parse_owner_repo owner_repo in
7981 let root_dir_path = clone_repo ~owner_repo ~local_path in
8082 let files = Lazy. force (read_root_tree ~root_dir_path ) in
8183 let { height; width } = get_terminal_dimensions ignore_size_warning in
82- { owner; repo; root_dir_path; files; width; height }
84+ { owner; repo; root_dir_path; files; width; height; no_nerd_font }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ type t = {
33 local_path : string option ;
44 log_file : string option ;
55 ignore_size_warning : bool ;
6+ no_nerd_font : bool ;
67}
78
89val init : t -> Model .initial_data
Original file line number Diff line number Diff line change 44 ;; Internal dependencies
55 fs
66 gh
7+ pretty
78 render))
Original file line number Diff line number Diff line change @@ -39,12 +39,12 @@ let apply_filter filter t =
3939 let scroll_start = 0 in
4040 { t with filter; issues; offset; scroll_start }
4141
42- let make ~owner ~repo =
42+ let make ~owner ~repo icons =
4343 let issues_and_errors =
4444 lazy
4545 (match Gh.Issue. issues ~owner ~repo with
4646 | Ok issues ->
47- let rendered = Render. issues issues in
47+ let rendered = Render. issues issues icons in
4848 (rendered, None )
4949 | Error err -> ([] , Some err))
5050 in
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ and filter =
2222val filter_all : filter
2323val filter_open : filter
2424val filter_closed : filter
25- val make : owner :string -> repo :string -> t
25+ val make : owner :string -> repo :string -> Pretty.Icon .t -> t
2626
2727(* * Change the filter to a new one and update currently selected issues. *)
2828val apply_filter : filter -> t -> t
You can’t perform that action at this time.
0 commit comments