An open-source cross-platform alternative to AirDrop
feat(cli): show target in file picker
Tien Do Nam69965f59c68d
diff --git a/cli/src/app/sending.rs b/cli/src/app/sending.rsindex e88593ef..09c77bf5 100644--- a/cli/src/app/sending.rs+++ b/cli/src/app/sending.rs@@ -41,7 +41,7 @@ impl App {self.ui.log(Category::Send, "A send is already in progress");return;}- match Picker::open(device.fingerprint) {+ match Picker::open(device.fingerprint, device.alias.clone()) {Ok(picker) => {self.ui.suspend();self.picker = Some(picker);diff --git a/cli/src/picker.rs b/cli/src/picker.rsindex da9e4d15..7f1ee0ff 100644--- a/cli/src/picker.rs+++ b/cli/src/picker.rs@@ -27,6 +27,9 @@ pub struct Picker {/// The fingerprint of the device the picked files will be sent to.pub fingerprint: String,+ /// The alias of that device, shown in the title.+ alias: String,+explorer: FileExplorer,terminal: Terminal<CrosstermBackend<Stdout>>,@@ -64,12 +67,13 @@ pub enum PickerOutcome {impl Picker {/// Enters the alternate screen and shows the picker./// The caller must suspend the log UI first and resume it after [Picker::close].- pub fn open(fingerprint: String) -> anyhow::Result<Self> {+ pub fn open(fingerprint: String, alias: String) -> anyhow::Result<Self> {let explorer = FileExplorer::new()?;util::enter_alternate_screen()?;let terminal = Terminal::new(CrosstermBackend::new(std::io::stdout()))?;let mut picker = Self {fingerprint,+ alias,explorer,terminal,selected: Vec::new(),@@ -275,6 +279,7 @@ impl Picker {pub fn draw(&mut self) {let Self {+ alias,explorer,terminal,selected,@@ -285,10 +290,8 @@ impl Picker {..} = self;- let help = format!(- " Type: filter ←/→: folder Space: select ({}) Enter: confirm Esc: clear/cancel",- selected.len()- );+ let help =+ " Type: filter ←/→: folder Space: select Enter: confirm Esc: cancel".to_string();let _ = terminal.draw(|frame| {let [main_area, selected_area, help_area] = Layout::vertical([Constraint::Fill(1),@@ -299,7 +302,8 @@ impl Picker {let mut block = Block::default().borders(Borders::ALL)- .title_top(format!(" {} ", explorer.cwd().display()));+ .title_top(format!(" {} ", explorer.cwd().display()))+ .title_top(Line::from(format!(" To: {alias} ")).right_aligned());if !query.is_empty() {let hits = match matches.is_empty() {true => " no matches".to_string(),