1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use colored::Colorize;

use tabled::object::Segment;
use tabled::style::Color;
use tabled::{Alignment, Modify, Panel, Rotate, Style, Table};

use common::command::ProcessResult;
use common::contract::state::tick_array::TickArray;

pub fn process(tick_index: i32, tick_spacing: u16) -> ProcessResult {
    let array_info = TickArray::array_info(tick_index, tick_spacing);
    let color = Color::try_from(" ".cyan().to_string()).unwrap();
    Ok(Table::new(vec![array_info])
        .with(Rotate::Bottom)
        .with(Rotate::Right)
        .with(Style::modern())
        .with(color)
        .with(Panel("Array Index Info", 0))
        .with(Modify::new(Segment::all()).with(Alignment::center()))
        .to_string())
}