Skip to content

Commit 20497ff

Browse files
committed
fixup minor format
1 parent fd7f17a commit 20497ff

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

src/client/opamCommands.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2593,7 +2593,8 @@ let repository cli =
25932593
then switches
25942594
else all_switches
25952595
in
2596-
OpamRepositoryCommand.show_repo rt ~switches (OpamRepositoryName.of_string repo_name);
2596+
OpamRepositoryCommand.show_repo rt ~switches
2597+
(OpamRepositoryName.of_string repo_name);
25972598
`Ok ()
25982599
| command, params -> bad_subcommand ~cli commands ("repository", command, params)
25992600
in

src/client/opamRepositoryCommand.ml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,23 +220,30 @@ let list_all rt ~short =
220220
OpamConsole.print_table stdout ~sep:" "
221221

222222
let show_repo rt ~switches repo_name =
223-
let repos = List.filter_map (fun sw ->
224-
let sw_name = OpamSwitch.to_string sw in
225-
match switch_repos rt sw |> List.mapi (fun i repo -> (i+1, repo)) |> List.filter (fun (_, repo) -> repo = repo_name) with
226-
| [] -> None
227-
| repos -> Some (sw_name, repos)
228-
) switches in
229-
List.iter (fun (sw_name, repos) ->
223+
let repos =
224+
List.filter_map (fun sw ->
225+
let repos =
226+
switch_repos rt sw |>
227+
List.mapi (fun i repo -> (i+1, repo)) |>
228+
List.filter (fun (_, repo) -> OpamRepositoryName.equal repo repo_name)
229+
in
230+
match repos with
231+
| [] -> None
232+
| repos -> Some (sw, repos)
233+
) switches
234+
in
235+
List.iter (fun (sw, repos) ->
230236
List.iter (fun (rank, repo) ->
231237
try
232238
let r = OpamRepositoryName.Map.find repo rt.repositories in
233-
let url = if r.repo_url = OpamUrl.empty then "-" else
234-
OpamUrl.to_string r.repo_url |> OpamConsole.colorise `underline in
235-
OpamConsole.msg "switch: %s\n" sw_name;
239+
let url =
240+
OpamConsole.colorise `underline (OpamUrl.to_string r.repo_url)
241+
in
242+
OpamConsole.msg "switch: %s\n" (OpamSwitch.to_string sw);
236243
OpamConsole.msg "url: %s\n" url;
237244
OpamConsole.msg "rank: %d\n" rank;
238-
()
239-
with Not_found -> "not found" |> OpamConsole.colorise `red |> OpamConsole.msg "%s")
245+
with Not_found ->
246+
OpamConsole.msg "%s" (OpamConsole.colorise `red "not found"))
240247
repos)
241248
repos
242249

0 commit comments

Comments
 (0)