btcli_lib/ui/help.rs
1// Copyright (C) 2026 S.A. (@snoware)
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at https://mozilla.org/MPL/2.0/.
6
7use crate::extract_help;
8use cursive::traits::{Resizable, Scrollable};
9use cursive::views::{Dialog, ScrollView, TextView};
10
11pub fn build_help_view() -> Dialog {
12 let help_text = extract_help::get_help_info();
13
14 let scrollable_text = ScrollView::new(TextView::new(help_text))
15 .scrollable()
16 .fixed_height(20)
17 .fixed_width(60);
18
19 Dialog::around(scrollable_text)
20 .title("帮助")
21 .button("关闭", |s| {
22 let _ = s.pop_layer();
23 })
24} //没事不要用简写的闭包,头疼的要死,难看随他难看