Skip to content

Commit

Permalink
Renamed --sample-count-per-doc to --samples-per-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenldl committed Nov 25, 2024
1 parent c239bd3 commit 0936bf9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@

- Renamed `--index-chunk-token-count` to `--index-chunk-size`

- Renamed `--sample-count-per-doc` to `--samples-per-doc`

## 8.0.3

- Fixed single file view crash
Expand Down
16 changes: 8 additions & 8 deletions bin/args.ml
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,21 @@ let start_with_search_arg =

let sample_arg_name = "sample"

let sample_count_per_doc_arg_name = "sample-count-per-doc"
let samples_per_doc_arg_name = "samples-per-doc"

let sample_arg =
let doc =
Fmt.str "Search with expression EXP in non-interactive mode but only
show top N results where N is controlled by --%s."
sample_count_per_doc_arg_name
samples_per_doc_arg_name
in
Arg.(
value
& opt (some string) None
& info [ sample_arg_name ] ~doc ~docv:"EXP"
)

let sample_count_per_doc_arg =
let samples_per_doc_arg =
let doc =
Fmt.str
"Number of search results to show per document when --%s is used
Expand All @@ -229,8 +229,8 @@ or when samples printing is triggered."
in
Arg.(
value
& opt int Params.default_sample_count_per_document
& info [ sample_count_per_doc_arg_name ] ~doc ~docv:"N"
& opt int Params.default_samples_per_document
& info [ samples_per_doc_arg_name ] ~doc ~docv:"N"
)

let search_arg_name = "search"
Expand Down Expand Up @@ -430,7 +430,7 @@ let check
~tokens_per_search_scope_level
~index_chunk_size
~cache_soft_limit
~sample_count_per_doc
~samples_per_doc
~search_result_print_text_width
~search_result_print_snippet_min_size
~search_result_print_max_add_lines
Expand Down Expand Up @@ -465,9 +465,9 @@ let check
exit_with_error_msg
(Fmt.str "invalid %s: cannot be < 1" cache_soft_limit_arg_name)
);
if sample_count_per_doc < 1 then (
if samples_per_doc < 1 then (
exit_with_error_msg
(Fmt.str "invalid %s: cannot be < 1" sample_count_per_doc_arg_name)
(Fmt.str "invalid %s: cannot be < 1" samples_per_doc_arg_name)
);
if search_result_print_text_width < 1 then (
exit_with_error_msg
Expand Down
10 changes: 5 additions & 5 deletions bin/docfd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ let run
(index_only : bool)
(start_with_search : string option)
(sample_search_exp : string option)
(sample_count_per_doc : int)
(samples_per_doc : int)
(search_exp : string option)
(print_color_mode : Params.style_mode)
(print_underline_mode : Params.style_mode)
Expand All @@ -446,7 +446,7 @@ let run
~tokens_per_search_scope_level
~index_chunk_size
~cache_soft_limit
~sample_count_per_doc
~samples_per_doc
~search_result_print_text_width
~search_result_print_snippet_min_size
~search_result_print_max_add_lines
Expand Down Expand Up @@ -481,7 +481,7 @@ let run
Params.search_result_print_snippet_min_size := search_result_print_snippet_min_size;
Params.search_result_print_snippet_max_additional_lines_each_direction :=
search_result_print_max_add_lines;
Params.sample_count_per_document := sample_count_per_doc;
Params.samples_per_document := samples_per_doc;
Params.cache_dir := (
if no_cache then (
None
Expand Down Expand Up @@ -708,7 +708,7 @@ let run
(* Non-interactive mode *)
let print_limit =
match sample_search_exp with
| Some _ -> Some sample_count_per_doc
| Some _ -> Some samples_per_doc
| None -> None
in
match
Expand Down Expand Up @@ -1166,7 +1166,7 @@ let cmd ~env ~sw =
$ index_only_arg
$ start_with_search_arg
$ sample_arg
$ sample_count_per_doc_arg
$ samples_per_doc_arg
$ search_arg
$ color_arg
$ underline_arg
Expand Down
4 changes: 2 additions & 2 deletions bin/params.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ let hash_chunk_size = 4096

let text_editor = ref ""

let default_sample_count_per_document = 5
let default_samples_per_document = 5

let sample_count_per_document = ref default_sample_count_per_document
let samples_per_document = ref default_samples_per_document

type style_mode = [ `Never | `Always | `Auto ]

Expand Down

0 comments on commit 0936bf9

Please sign in to comment.