feat: change input title when using create --dir

This commit is contained in:
Tyarel8 2024-09-16 13:07:01 +02:00 committed by sxyazi
parent 28083d805e
commit 680da00d97
No known key found for this signature in database
4 changed files with 5 additions and 5 deletions

View file

@ -139,7 +139,7 @@ cd_origin = "top-center"
cd_offset = [ 0, 2, 50, 3 ] cd_offset = [ 0, 2, 50, 3 ]
# create # create
create_title = "Create:" create_title = [ "Create:", "Create (dir):" ]
create_origin = "top-center" create_origin = "top-center"
create_offset = [ 0, 2, 50, 3 ] create_offset = [ 0, 2, 50, 3 ]

View file

@ -14,7 +14,7 @@ pub struct Input {
pub cd_offset: Offset, pub cd_offset: Offset,
// create // create
pub create_title: String, pub create_title: [String; 2],
pub create_origin: Origin, pub create_origin: Origin,
pub create_offset: Offset, pub create_offset: Offset,

View file

@ -40,9 +40,9 @@ impl InputCfg {
} }
} }
pub fn create() -> Self { pub fn create(dir: bool) -> Self {
Self { Self {
title: INPUT.create_title.to_owned(), title: INPUT.create_title[dir as usize].to_owned(),
position: Position::new(INPUT.create_origin, INPUT.create_offset), position: Position::new(INPUT.create_origin, INPUT.create_offset),
..Default::default() ..Default::default()
} }

View file

@ -22,7 +22,7 @@ impl Manager {
let opt = opt.into() as Opt; let opt = opt.into() as Opt;
let cwd = self.cwd().to_owned(); let cwd = self.cwd().to_owned();
tokio::spawn(async move { tokio::spawn(async move {
let mut result = InputProxy::show(InputCfg::create()); let mut result = InputProxy::show(InputCfg::create(opt.dir));
let Some(Ok(name)) = result.recv().await else { let Some(Ok(name)) = result.recv().await else {
return Ok(()); return Ok(());
}; };