From a4efbee09400ddabeee859297f79d4fb72bc8379 Mon Sep 17 00:00:00 2001
From: Roland Sherwin <RolandSherwin@protonmail.com>
Date: Wed, 1 May 2024 21:13:56 +0530
Subject: [PATCH] refactor: rebased and removed custom rustfmt

---
 node-launchpad/.github/workflows/cd.yml  | 152 -----------------------
 node-launchpad/.github/workflows/ci.yml  |  63 ----------
 node-launchpad/.rustfmt.toml             |  16 ---
 node-launchpad/build.rs                  |   5 +-
 node-launchpad/src/app.rs                |  32 +++--
 node-launchpad/src/components/home.rs    | 119 +++++++++++++-----
 node-launchpad/src/components/options.rs |  29 +++--
 node-launchpad/src/components/tab.rs     |  29 +++--
 node-launchpad/src/config.rs             | 119 +++++++++++++-----
 node-launchpad/src/tui.rs                |  16 ++-
 node-launchpad/src/utils.rs              |  37 ++++--
 11 files changed, 283 insertions(+), 334 deletions(-)
 delete mode 100644 node-launchpad/.github/workflows/cd.yml
 delete mode 100644 node-launchpad/.github/workflows/ci.yml
 delete mode 100644 node-launchpad/.rustfmt.toml

diff --git a/node-launchpad/.github/workflows/cd.yml b/node-launchpad/.github/workflows/cd.yml
deleted file mode 100644
index f7c06cd77e..0000000000
--- a/node-launchpad/.github/workflows/cd.yml
+++ /dev/null
@@ -1,152 +0,0 @@
-name: CD # Continuous Deployment
-
-on:
-  push:
-    tags:
-      - '[v]?[0-9]+.[0-9]+.[0-9]+'
-
-jobs:
-  publish:
-
-    name: Publishing for ${{ matrix.os }}
-    runs-on: ${{ matrix.os }}
-
-    strategy:
-      matrix:
-        include:
-          - os: macos-latest
-            os-name: macos
-            target: x86_64-apple-darwin
-            architecture: x86_64
-            binary-postfix: ""
-            binary-name: node-tui
-            use-cross: false
-          - os: macos-latest
-            os-name: macos
-            target: aarch64-apple-darwin
-            architecture: arm64
-            binary-postfix: ""
-            use-cross: false
-            binary-name: node-tui
-          - os: ubuntu-latest
-            os-name: linux
-            target: x86_64-unknown-linux-gnu
-            architecture: x86_64
-            binary-postfix: ""
-            use-cross: false
-            binary-name: node-tui
-          - os: windows-latest
-            os-name: windows
-            target: x86_64-pc-windows-msvc
-            architecture: x86_64
-            binary-postfix: ".exe"
-            use-cross: false
-            binary-name: node-tui
-          - os: ubuntu-latest
-            os-name: linux
-            target: aarch64-unknown-linux-gnu
-            architecture: arm64
-            binary-postfix: ""
-            use-cross: true
-            binary-name: node-tui
-          - os: ubuntu-latest
-            os-name: linux
-            target: i686-unknown-linux-gnu
-            architecture: i686
-            binary-postfix: ""
-            use-cross: true
-            binary-name: node-tui
-
-    steps:
-      - name: Checkout repository
-        uses: actions/checkout@v4
-      - name: Install Rust toolchain
-        uses: actions-rs/toolchain@v1
-        with:
-          toolchain: stable
-
-          target: ${{ matrix.target }}
-
-          profile: minimal
-          override: true
-      - uses: Swatinem/rust-cache@v2
-      - name: Cargo build
-        uses: actions-rs/cargo@v1
-        with:
-          command: build
-
-          use-cross: ${{ matrix.use-cross }}
-
-          toolchain: stable
-
-          args: --release --target ${{ matrix.target }}
-
-
-      - name: install strip command
-        shell: bash
-        run: |
-
-          if [[ ${{ matrix.target }} == aarch64-unknown-linux-gnu ]]; then
-
-              sudo apt update
-              sudo apt-get install -y binutils-aarch64-linux-gnu
-          fi
-      - name: Packaging final binary
-        shell: bash
-        run: |
-
-          cd target/${{ matrix.target }}/release
-
-
-          ####### reduce binary size by removing debug symbols #######
-
-          BINARY_NAME=${{ matrix.binary-name }}${{ matrix.binary-postfix }}
-          if [[ ${{ matrix.target }} == aarch64-unknown-linux-gnu ]]; then
-
-            GCC_PREFIX="aarch64-linux-gnu-"
-          else
-            GCC_PREFIX=""
-          fi
-          "$GCC_PREFIX"strip $BINARY_NAME
-
-          ########## create tar.gz ##########
-
-          RELEASE_NAME=${{ matrix.binary-name }}-${GITHUB_REF/refs\/tags\//}-${{ matrix.os-name }}-${{ matrix.architecture }}
-
-          tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME
-
-          ########## create sha256 ##########
-
-          if [[ ${{ runner.os }} == 'Windows' ]]; then
-
-            certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256
-          else
-            shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256
-          fi
-      - name: Releasing assets
-        uses: softprops/action-gh-release@v1
-        with:
-          files: |
-
-            target/${{ matrix.target }}/release/${{ matrix.binary-name }}-*.tar.gz
-            target/${{ matrix.target }}/release/${{ matrix.binary-name }}-*.sha256
-
-        env:
-
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
-
-  publish-cargo:
-    name: Publishing to Cargo
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout repository
-        uses: actions/checkout@v4
-      - name: Install Rust toolchain
-        uses: dtolnay/rust-toolchain@stable
-      - uses: Swatinem/rust-cache@v2
-      - run: cargo publish
-        env:
-
-          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
-
diff --git a/node-launchpad/.github/workflows/ci.yml b/node-launchpad/.github/workflows/ci.yml
deleted file mode 100644
index c64fbee9e3..0000000000
--- a/node-launchpad/.github/workflows/ci.yml
+++ /dev/null
@@ -1,63 +0,0 @@
-name: CI # Continuous Integration
-
-on:
-  push:
-    branches:
-      - main
-  pull_request:
-
-jobs:
-
-  test:
-    name: Test Suite
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout repository
-        uses: actions/checkout@v4
-      - name: Install Rust toolchain
-        uses: dtolnay/rust-toolchain@nightly
-      - uses: Swatinem/rust-cache@v2
-      - name: Run tests
-        run: cargo test --all-features --workspace
-
-  rustfmt:
-    name: Rustfmt
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout repository
-        uses: actions/checkout@v4
-      - name: Install Rust toolchain
-        uses: dtolnay/rust-toolchain@nightly
-        with:
-          components: rustfmt
-      - uses: Swatinem/rust-cache@v2
-      - name: Check formatting
-        run: cargo fmt --all --check
-
-  clippy:
-    name: Clippy
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout repository
-        uses: actions/checkout@v4
-      - name: Install Rust toolchain
-        uses: dtolnay/rust-toolchain@nightly
-        with:
-          components: clippy
-      - uses: Swatinem/rust-cache@v2
-      - name: Clippy check
-        run: cargo clippy --all-targets --all-features --workspace -- -D warnings
-
-  docs:
-    name: Docs
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout repository
-        uses: actions/checkout@v4
-      - name: Install Rust toolchain
-        uses: dtolnay/rust-toolchain@nightly
-      - uses: Swatinem/rust-cache@v2
-      - name: Check documentation
-        env:
-          RUSTDOCFLAGS: -D warnings
-        run: cargo doc --no-deps --document-private-items --all-features --workspace --examples
diff --git a/node-launchpad/.rustfmt.toml b/node-launchpad/.rustfmt.toml
deleted file mode 100644
index 491199d2b9..0000000000
--- a/node-launchpad/.rustfmt.toml
+++ /dev/null
@@ -1,16 +0,0 @@
-max_width = 120
-use_small_heuristics = "Max"
-empty_item_single_line = false
-force_multiline_blocks = true
-format_code_in_doc_comments = true
-match_block_trailing_comma = true
-imports_granularity = "Crate"
-normalize_comments = true
-normalize_doc_attributes = true
-overflow_delimited_expr = true
-reorder_impl_items = true
-reorder_imports = true
-group_imports = "StdExternalCrate"
-tab_spaces = 4
-use_field_init_shorthand = true
-use_try_shorthand = true
diff --git a/node-launchpad/build.rs b/node-launchpad/build.rs
index 23757b5cbd..17db54bab1 100644
--- a/node-launchpad/build.rs
+++ b/node-launchpad/build.rs
@@ -7,6 +7,9 @@
 // permissions and limitations relating to use of the SAFE Network Software.
 
 fn main() -> Result<(), Box<dyn std::error::Error>> {
-    vergen::EmitBuilder::builder().all_build().all_git().emit()?;
+    vergen::EmitBuilder::builder()
+        .all_build()
+        .all_git()
+        .emit()?;
     Ok(())
 }
diff --git a/node-launchpad/src/app.rs b/node-launchpad/src/app.rs
index 0622378fc8..8ab1343d39 100644
--- a/node-launchpad/src/app.rs
+++ b/node-launchpad/src/app.rs
@@ -54,7 +54,9 @@ impl App {
     pub async fn run(&mut self) -> Result<()> {
         let (action_tx, mut action_rx) = mpsc::unbounded_channel();
 
-        let mut tui = tui::Tui::new()?.tick_rate(self.tick_rate).frame_rate(self.frame_rate);
+        let mut tui = tui::Tui::new()?
+            .tick_rate(self.tick_rate)
+            .frame_rate(self.frame_rate);
         // tui.mouse(true);
         tui.enter()?;
 
@@ -102,8 +104,8 @@ impl App {
                                 }
                             }
                         }
-                    },
-                    _ => {},
+                    }
+                    _ => {}
                 }
             }
 
@@ -114,7 +116,7 @@ impl App {
                 match action {
                     Action::Tick => {
                         self.last_tick_key_events.drain(..);
-                    },
+                    }
                     Action::Quit => self.should_quit = true,
                     Action::Suspend => self.should_suspend = true,
                     Action::Resume => self.should_suspend = false,
@@ -124,30 +126,34 @@ impl App {
                             for component in self.components.iter_mut() {
                                 let r = component.draw(f, f.size());
                                 if let Err(e) = r {
-                                    action_tx.send(Action::Error(format!("Failed to draw: {:?}", e))).unwrap();
+                                    action_tx
+                                        .send(Action::Error(format!("Failed to draw: {:?}", e)))
+                                        .unwrap();
                                 }
                             }
                         })?;
-                    },
+                    }
                     Action::Render => {
                         tui.draw(|f| {
                             for component in self.components.iter_mut() {
                                 let r = component.draw(f, f.size());
                                 if let Err(e) = r {
-                                    action_tx.send(Action::Error(format!("Failed to draw: {:?}", e))).unwrap();
+                                    action_tx
+                                        .send(Action::Error(format!("Failed to draw: {:?}", e)))
+                                        .unwrap();
                                 }
                             }
                         })?;
-                    },
+                    }
                     Action::SwitchScene(scene) => {
                         info!("Scene swtiched to: {scene:?}");
                         self.scene = scene;
-                    },
+                    }
                     Action::SwitchInputMode(mode) => {
                         info!("Input mode switched to: {mode:?}");
                         self.input_mode = mode;
-                    },
-                    _ => {},
+                    }
+                    _ => {}
                 }
                 for component in self.components.iter_mut() {
                     if let Some(action) = component.update(action.clone())? {
@@ -158,7 +164,9 @@ impl App {
             if self.should_suspend {
                 tui.suspend()?;
                 action_tx.send(Action::Resume)?;
-                tui = tui::Tui::new()?.tick_rate(self.tick_rate).frame_rate(self.frame_rate);
+                tui = tui::Tui::new()?
+                    .tick_rate(self.tick_rate)
+                    .frame_rate(self.frame_rate);
                 // tui.mouse(true);
                 tui.enter()?;
             } else if self.should_quit {
diff --git a/node-launchpad/src/components/home.rs b/node-launchpad/src/components/home.rs
index 075f0df470..d59edd27e9 100644
--- a/node-launchpad/src/components/home.rs
+++ b/node-launchpad/src/components/home.rs
@@ -17,7 +17,7 @@ use ratatui::{prelude::*, widgets::*};
 use sn_node_manager::config::get_node_registry_path;
 use sn_peers_acquisition::PeersArgs;
 use sn_service_management::{NodeRegistry, NodeServiceData, ServiceStatus};
-use tokio::sync::mpsc::{UnboundedSender};
+use tokio::sync::mpsc::UnboundedSender;
 
 #[derive(Default)]
 pub struct Home {
@@ -37,7 +37,10 @@ pub struct Home {
 
 impl Home {
     pub fn new(peers_args: PeersArgs) -> Result<Self> {
-        let mut home = Self { peers_args, ..Default::default() };
+        let mut home = Self {
+            peers_args,
+            ..Default::default()
+        };
         home.load_node_registry()?;
         home.show_scene = true;
         Ok(home)
@@ -77,7 +80,8 @@ impl Component for Home {
                         None,
                         None,
                         None,
-                        true,
+                        false,
+                        false,
                         None,
                         None,
                         None,
@@ -96,11 +100,13 @@ impl Component for Home {
                     }
                     info!("Successfully added service");
                     // todo: need to handle these properly?
-                    if let Err(err) = action_sender.send(Action::HomeActions(HomeActions::AddNodeCompleted)) {
+                    if let Err(err) =
+                        action_sender.send(Action::HomeActions(HomeActions::AddNodeCompleted))
+                    {
                         error!("Error while sending action: {err:?}");
                     }
                 });
-            },
+            }
             Action::HomeActions(HomeActions::StartNodes) => {
                 if self.lock_registry {
                     error!("Registry is locked. Cannot start node now.");
@@ -111,18 +117,24 @@ impl Component for Home {
 
                 self.lock_registry = true;
                 tokio::task::spawn_local(async move {
-                    if let Err(err) =
-                        sn_node_manager::cmd::node::start(1, vec![], vec![], sn_node_manager::VerbosityLevel::Minimal)
-                            .await
+                    if let Err(err) = sn_node_manager::cmd::node::start(
+                        1,
+                        vec![],
+                        vec![],
+                        sn_node_manager::VerbosityLevel::Minimal,
+                    )
+                    .await
                     {
                         error!("Error while starting services {err:?}");
                     }
-                    if let Err(err) = action_sender.send(Action::HomeActions(HomeActions::StartNodesCompleted)) {
+                    if let Err(err) =
+                        action_sender.send(Action::HomeActions(HomeActions::StartNodesCompleted))
+                    {
                         error!("Error while sending action: {err:?}");
                     }
                     info!("Successfully started services");
                 });
-            },
+            }
             Action::HomeActions(HomeActions::StopNode) => {
                 if self.lock_registry {
                     error!("Registry is locked. Cannot stop node now.");
@@ -133,30 +145,36 @@ impl Component for Home {
 
                 self.lock_registry = true;
                 tokio::task::spawn_local(async move {
-                    if let Err(err) =
-                        sn_node_manager::cmd::node::stop(vec![], vec![], sn_node_manager::VerbosityLevel::Minimal).await
+                    if let Err(err) = sn_node_manager::cmd::node::stop(
+                        vec![],
+                        vec![],
+                        sn_node_manager::VerbosityLevel::Minimal,
+                    )
+                    .await
                     {
                         error!("Error while stopping services {err:?}");
                     }
-                    if let Err(err) = action_sender.send(Action::HomeActions(HomeActions::StopNodeCompleted)) {
+                    if let Err(err) =
+                        action_sender.send(Action::HomeActions(HomeActions::StopNodeCompleted))
+                    {
                         error!("Error while sending action: {err:?}");
                     }
                     info!("Successfully stopped services");
                 });
-            },
+            }
             Action::HomeActions(HomeActions::AddNodeCompleted)
             | Action::HomeActions(HomeActions::StartNodesCompleted)
             | Action::HomeActions(HomeActions::StopNodeCompleted) => {
                 self.lock_registry = false;
                 self.load_node_registry()?;
-            },
+            }
             Action::HomeActions(HomeActions::PreviousTableItem) => {
                 self.select_previous_table_item();
-            },
+            }
             Action::HomeActions(HomeActions::NextTableItem) => {
                 self.select_next_table_item();
-            },
-            _ => {},
+            }
+            _ => {}
         }
         Ok(None)
     }
@@ -169,7 +187,12 @@ impl Component for Home {
         // index 0 is reserved for tab
         let layer_zero = Layout::new(
             Direction::Vertical,
-            [Constraint::Max(1), Constraint::Min(5), Constraint::Min(3), Constraint::Max(3)],
+            [
+                Constraint::Max(1),
+                Constraint::Min(5),
+                Constraint::Min(3),
+                Constraint::Max(3),
+            ],
         )
         .split(area);
         let popup_area = Self::centered_rect(25, 25, area);
@@ -177,7 +200,11 @@ impl Component for Home {
         // top section
         //
         f.render_widget(
-            Paragraph::new("None").block(Block::default().title("Autonomi Node Status").borders(Borders::ALL)),
+            Paragraph::new("None").block(
+                Block::default()
+                    .title("Autonomi Node Status")
+                    .borders(Borders::ALL),
+            ),
             layer_zero[1],
         );
 
@@ -199,19 +226,34 @@ impl Component for Home {
             })
             .collect();
 
-        let widths = [Constraint::Max(15), Constraint::Min(30), Constraint::Max(10)];
+        let widths = [
+            Constraint::Max(15),
+            Constraint::Min(30),
+            Constraint::Max(10),
+        ];
         let table = Table::new(rows, widths)
             .column_spacing(2)
-            .header(Row::new(vec!["Service", "PeerId", "Status"]).style(Style::new().bold()).bottom_margin(1))
+            .header(
+                Row::new(vec!["Service", "PeerId", "Status"])
+                    .style(Style::new().bold())
+                    .bottom_margin(1),
+            )
             .highlight_style(Style::new().reversed())
-            .block(Block::default().title("Running Nodes").borders(Borders::ALL))
+            .block(
+                Block::default()
+                    .title("Running Nodes")
+                    .borders(Borders::ALL),
+            )
             .highlight_symbol(">");
 
         f.render_stateful_widget(table, layer_zero[2], &mut self.node_table_state);
 
         f.render_widget(
-            Paragraph::new("[A]dd node, [S]tart node, [K]ill node, [Q]uit, [Tab] Next Page")
-                .block(Block::default().title(" Key commands ").borders(Borders::ALL)),
+            Paragraph::new("[A]dd node, [S]tart node, [K]ill node, [Q]uit, [Tab] Next Page").block(
+                Block::default()
+                    .title(" Key commands ")
+                    .borders(Borders::ALL),
+            ),
             layer_zero[3],
         );
 
@@ -221,7 +263,11 @@ impl Component for Home {
             f.render_widget(
                 Paragraph::new("Adding/Starting Node.. Please wait...")
                     .alignment(Alignment::Center)
-                    .block(Block::default().borders(Borders::ALL).style(Style::default().bg(Color::Reset))),
+                    .block(
+                        Block::default()
+                            .borders(Borders::ALL)
+                            .style(Style::default().bg(Color::Reset)),
+                    ),
                 popup_area,
             );
         }
@@ -232,14 +278,22 @@ impl Component for Home {
 
 impl Home {
     fn get_actions_sender(&self) -> Result<UnboundedSender<Action>> {
-        self.action_sender.clone().ok_or_eyre("Action sender not registered")
+        self.action_sender
+            .clone()
+            .ok_or_eyre("Action sender not registered")
     }
 
     fn load_node_registry(&mut self) -> Result<()> {
         let node_registry = NodeRegistry::load(&get_node_registry_path()?)?;
-        self.running_nodes =
-            node_registry.nodes.into_iter().filter(|node| node.status != ServiceStatus::Removed).collect();
-        info!("Loaded node registry. Runnign nodes: {:?}", self.running_nodes.len());
+        self.running_nodes = node_registry
+            .nodes
+            .into_iter()
+            .filter(|node| node.status != ServiceStatus::Removed)
+            .collect();
+        info!(
+            "Loaded node registry. Runnign nodes: {:?}",
+            self.running_nodes.len()
+        );
 
         Ok(())
     }
@@ -252,7 +306,7 @@ impl Home {
                 } else {
                     i + 1
                 }
-            },
+            }
             None => 0,
         };
         self.node_table_state.select(Some(i));
@@ -266,12 +320,13 @@ impl Home {
                 } else {
                     i - 1
                 }
-            },
+            }
             None => 0,
         };
         self.node_table_state.select(Some(i));
     }
 
+    #[allow(dead_code)]
     fn unselect_table_item(&mut self) {
         self.node_table_state.select(None);
     }
diff --git a/node-launchpad/src/components/options.rs b/node-launchpad/src/components/options.rs
index 65744d1afb..6c3123c4ec 100644
--- a/node-launchpad/src/components/options.rs
+++ b/node-launchpad/src/components/options.rs
@@ -30,14 +30,14 @@ impl Component for Options {
         match key.code {
             KeyCode::Esc => {
                 return Ok(Some(Action::SwitchInputMode(InputMode::Navigation)));
-            },
+            }
             KeyCode::Down => {
                 // self.select_next_input_field();
-            },
+            }
             KeyCode::Up => {
                 // self.select_previous_input_field();
-            },
-            _ => {},
+            }
+            _ => {}
         }
         self.input.handle_event(&Event::Key(key));
         Ok(None)
@@ -50,7 +50,7 @@ impl Component for Options {
                 _ => self.show_scene = false,
             },
             Action::SwitchInputMode(mode) => self.input_mode = mode,
-            _ => {},
+            _ => {}
         };
         Ok(None)
     }
@@ -61,8 +61,11 @@ impl Component for Options {
         }
 
         // index 0 is reserved for tab; 2 is for keybindings
-        let layer_zero =
-            Layout::new(Direction::Vertical, [Constraint::Max(1), Constraint::Min(15), Constraint::Max(3)]).split(area);
+        let layer_zero = Layout::new(
+            Direction::Vertical,
+            [Constraint::Max(1), Constraint::Min(15), Constraint::Max(3)],
+        )
+        .split(area);
 
         // break the index 1 into sub sections
         let layer_one = Layout::new(
@@ -80,7 +83,11 @@ impl Component for Options {
 
         let input = Paragraph::new(self.input.value())
             .style(Style::default())
-            .block(Block::default().borders(Borders::ALL).title("Peer MultiAddress"));
+            .block(
+                Block::default()
+                    .borders(Borders::ALL)
+                    .title("Peer MultiAddress"),
+            );
         f.render_widget(input, layer_one[0]);
         let input = Paragraph::new(self.input.value())
             .style(Style::default())
@@ -88,7 +95,11 @@ impl Component for Options {
         f.render_widget(input, layer_one[1]);
         let input = Paragraph::new(self.input.value())
             .style(Style::default())
-            .block(Block::default().borders(Borders::ALL).title("Data dir Path"));
+            .block(
+                Block::default()
+                    .borders(Borders::ALL)
+                    .title("Data dir Path"),
+            );
         f.render_widget(input, layer_one[2]);
         let input = Paragraph::new(self.input.value())
             .style(Style::default())
diff --git a/node-launchpad/src/components/tab.rs b/node-launchpad/src/components/tab.rs
index 2d91bd15b2..a3f03c7684 100644
--- a/node-launchpad/src/components/tab.rs
+++ b/node-launchpad/src/components/tab.rs
@@ -25,7 +25,10 @@ pub struct Tab {
 
 impl Default for Tab {
     fn default() -> Self {
-        Self { scene_list: vec![Scene::Home, Scene::Options], current_tab_index: 0 }
+        Self {
+            scene_list: vec![Scene::Home, Scene::Options],
+            current_tab_index: 0,
+        }
     }
 }
 
@@ -48,18 +51,21 @@ impl Component for Tab {
                 let new_scene = self.scene_list[self.current_tab_index];
                 trace!(?new_scene, "Updated tab:");
                 Some(Action::SwitchScene(new_scene))
-            },
+            }
 
             Action::TabActions(TabActions::PreviousTab) => {
                 trace!(?self.current_tab_index, "Got PreviousTab");
-                let new_index =
-                    if self.current_tab_index == 0 { self.scene_list.len() - 1 } else { self.current_tab_index - 1 };
+                let new_index = if self.current_tab_index == 0 {
+                    self.scene_list.len() - 1
+                } else {
+                    self.current_tab_index - 1
+                };
                 self.current_tab_index = new_index;
 
                 let new_scene = self.scene_list[self.current_tab_index];
                 trace!(?new_scene, "Updated tab:");
                 Some(Action::SwitchScene(new_scene))
-            },
+            }
             _ => None,
         };
         Ok(send_back)
@@ -68,10 +74,19 @@ impl Component for Tab {
     fn draw(&mut self, f: &mut crate::tui::Frame<'_>, area: ratatui::prelude::Rect) -> Result<()> {
         let layer_zero = Layout::new(
             Direction::Vertical,
-            [Constraint::Max(1), Constraint::Min(5), Constraint::Min(3), Constraint::Max(3)],
+            [
+                Constraint::Max(1),
+                Constraint::Min(5),
+                Constraint::Min(3),
+                Constraint::Max(3),
+            ],
         )
         .split(area);
-        let tab_items = self.scene_list.iter().map(|item| format!("{item:?}")).collect::<Vec<_>>();
+        let tab_items = self
+            .scene_list
+            .iter()
+            .map(|item| format!("{item:?}"))
+            .collect::<Vec<_>>();
         let tab = Tabs::new(tab_items)
             .style(Style::default().white())
             .highlight_style(Style::default().yellow())
diff --git a/node-launchpad/src/config.rs b/node-launchpad/src/config.rs
index be1e3d9caf..ee8cde7783 100644
--- a/node-launchpad/src/config.rs
+++ b/node-launchpad/src/config.rs
@@ -52,7 +52,11 @@ impl Config {
         ];
         let mut found_config = false;
         for (file, format) in &config_files {
-            builder = builder.add_source(config::File::from(config_dir.join(file)).format(*format).required(false));
+            builder = builder.add_source(
+                config::File::from(config_dir.join(file))
+                    .format(*format)
+                    .required(false),
+            );
             if config_dir.join(file).exists() {
                 found_config = true
             }
@@ -66,13 +70,17 @@ impl Config {
         for (mode, default_bindings) in default_config.keybindings.iter() {
             let user_bindings = cfg.keybindings.entry(*mode).or_default();
             for (key, cmd) in default_bindings.iter() {
-                user_bindings.entry(key.clone()).or_insert_with(|| cmd.clone());
+                user_bindings
+                    .entry(key.clone())
+                    .or_insert_with(|| cmd.clone());
             }
         }
         for (mode, default_styles) in default_config.styles.iter() {
             let user_styles = cfg.styles.entry(*mode).or_default();
             for (style_key, style) in default_styles.iter() {
-                user_styles.entry(style_key.clone()).or_insert_with(|| *style);
+                user_styles
+                    .entry(style_key.clone())
+                    .or_insert_with(|| *style);
             }
         }
 
@@ -93,8 +101,10 @@ impl<'de> Deserialize<'de> for KeyBindings {
         let keybindings = parsed_map
             .into_iter()
             .map(|(mode, inner_map)| {
-                let converted_inner_map =
-                    inner_map.into_iter().map(|(key_str, cmd)| (parse_key_sequence(&key_str).unwrap(), cmd)).collect();
+                let converted_inner_map = inner_map
+                    .into_iter()
+                    .map(|(key_str, cmd)| (parse_key_sequence(&key_str).unwrap(), cmd))
+                    .collect();
                 (mode, converted_inner_map)
             })
             .collect();
@@ -118,15 +128,15 @@ fn extract_modifiers(raw: &str) -> (&str, KeyModifiers) {
             rest if rest.starts_with("ctrl-") => {
                 modifiers.insert(KeyModifiers::CONTROL);
                 current = &rest[5..];
-            },
+            }
             rest if rest.starts_with("alt-") => {
                 modifiers.insert(KeyModifiers::ALT);
                 current = &rest[4..];
-            },
+            }
             rest if rest.starts_with("shift-") => {
                 modifiers.insert(KeyModifiers::SHIFT);
                 current = &rest[6..];
-            },
+            }
             _ => break, // break out of the loop if no known prefix is detected
         };
     }
@@ -134,7 +144,10 @@ fn extract_modifiers(raw: &str) -> (&str, KeyModifiers) {
     (current, modifiers)
 }
 
-fn parse_key_code_with_modifiers(raw: &str, mut modifiers: KeyModifiers) -> Result<KeyEvent, String> {
+fn parse_key_code_with_modifiers(
+    raw: &str,
+    mut modifiers: KeyModifiers,
+) -> Result<KeyEvent, String> {
     let c = match raw {
         "esc" => KeyCode::Esc,
         "enter" => KeyCode::Enter,
@@ -149,7 +162,7 @@ fn parse_key_code_with_modifiers(raw: &str, mut modifiers: KeyModifiers) -> Resu
         "backtab" => {
             modifiers.insert(KeyModifiers::SHIFT);
             KeyCode::BackTab
-        },
+        }
         "backspace" => KeyCode::Backspace,
         "delete" => KeyCode::Delete,
         "insert" => KeyCode::Insert,
@@ -175,7 +188,7 @@ fn parse_key_code_with_modifiers(raw: &str, mut modifiers: KeyModifiers) -> Resu
                 c = c.to_ascii_uppercase();
             }
             KeyCode::Char(c)
-        },
+        }
         _ => return Err(format!("Unable to parse {raw}")),
     };
     Ok(KeyEvent::new(c, modifiers))
@@ -201,12 +214,12 @@ pub fn key_event_to_string(key_event: &KeyEvent) -> String {
         KeyCode::F(c) => {
             char = format!("f({c})");
             &char
-        },
+        }
         KeyCode::Char(' ') => "space",
         KeyCode::Char(c) => {
             char = c.to_string();
             &char
-        },
+        }
         KeyCode::Esc => "esc",
         KeyCode::Null => "",
         KeyCode::CapsLock => "",
@@ -284,8 +297,10 @@ impl<'de> Deserialize<'de> for Styles {
         let styles = parsed_map
             .into_iter()
             .map(|(mode, inner_map)| {
-                let converted_inner_map =
-                    inner_map.into_iter().map(|(str, style)| (str, parse_style(&style))).collect();
+                let converted_inner_map = inner_map
+                    .into_iter()
+                    .map(|(str, style)| (str, parse_style(&style)))
+                    .collect();
                 (mode, converted_inner_map)
             })
             .collect();
@@ -295,7 +310,8 @@ impl<'de> Deserialize<'de> for Styles {
 }
 
 pub fn parse_style(line: &str) -> Style {
-    let (foreground, background) = line.split_at(line.to_lowercase().find("on ").unwrap_or(line.len()));
+    let (foreground, background) =
+        line.split_at(line.to_lowercase().find("on ").unwrap_or(line.len()));
     let foreground = process_color_string(foreground);
     let background = process_color_string(&background.replace("on ", ""));
 
@@ -337,13 +353,22 @@ fn parse_color(s: &str) -> Option<Color> {
     let s = s.trim_end();
     if s.contains("bright color") {
         let s = s.trim_start_matches("bright ");
-        let c = s.trim_start_matches("color").parse::<u8>().unwrap_or_default();
+        let c = s
+            .trim_start_matches("color")
+            .parse::<u8>()
+            .unwrap_or_default();
         Some(Color::Indexed(c.wrapping_shl(8)))
     } else if s.contains("color") {
-        let c = s.trim_start_matches("color").parse::<u8>().unwrap_or_default();
+        let c = s
+            .trim_start_matches("color")
+            .parse::<u8>()
+            .unwrap_or_default();
         Some(Color::Indexed(c))
     } else if s.contains("gray") {
-        let c = 232 + s.trim_start_matches("gray").parse::<u8>().unwrap_or_default();
+        let c = 232
+            + s.trim_start_matches("gray")
+                .parse::<u8>()
+                .unwrap_or_default();
         Some(Color::Indexed(c))
     } else if s.contains("rgb") {
         let red = (s.as_bytes()[3] as char).to_digit(10).unwrap_or_default() as u8;
@@ -445,7 +470,11 @@ mod tests {
     fn test_config() -> Result<()> {
         let c = Config::new()?;
         assert_eq!(
-            c.keybindings.get(&Scene::Home).unwrap().get(&parse_key_sequence("<q>").unwrap_or_default()).unwrap(),
+            c.keybindings
+                .get(&Scene::Home)
+                .unwrap()
+                .get(&parse_key_sequence("<q>").unwrap_or_default())
+                .unwrap(),
             &Action::Quit
         );
         Ok(())
@@ -453,27 +482,48 @@ mod tests {
 
     #[test]
     fn test_simple_keys() {
-        assert_eq!(parse_key_event("a").unwrap(), KeyEvent::new(KeyCode::Char('a'), KeyModifiers::empty()));
+        assert_eq!(
+            parse_key_event("a").unwrap(),
+            KeyEvent::new(KeyCode::Char('a'), KeyModifiers::empty())
+        );
 
-        assert_eq!(parse_key_event("enter").unwrap(), KeyEvent::new(KeyCode::Enter, KeyModifiers::empty()));
+        assert_eq!(
+            parse_key_event("enter").unwrap(),
+            KeyEvent::new(KeyCode::Enter, KeyModifiers::empty())
+        );
 
-        assert_eq!(parse_key_event("esc").unwrap(), KeyEvent::new(KeyCode::Esc, KeyModifiers::empty()));
+        assert_eq!(
+            parse_key_event("esc").unwrap(),
+            KeyEvent::new(KeyCode::Esc, KeyModifiers::empty())
+        );
     }
 
     #[test]
     fn test_with_modifiers() {
-        assert_eq!(parse_key_event("ctrl-a").unwrap(), KeyEvent::new(KeyCode::Char('a'), KeyModifiers::CONTROL));
+        assert_eq!(
+            parse_key_event("ctrl-a").unwrap(),
+            KeyEvent::new(KeyCode::Char('a'), KeyModifiers::CONTROL)
+        );
 
-        assert_eq!(parse_key_event("alt-enter").unwrap(), KeyEvent::new(KeyCode::Enter, KeyModifiers::ALT));
+        assert_eq!(
+            parse_key_event("alt-enter").unwrap(),
+            KeyEvent::new(KeyCode::Enter, KeyModifiers::ALT)
+        );
 
-        assert_eq!(parse_key_event("shift-esc").unwrap(), KeyEvent::new(KeyCode::Esc, KeyModifiers::SHIFT));
+        assert_eq!(
+            parse_key_event("shift-esc").unwrap(),
+            KeyEvent::new(KeyCode::Esc, KeyModifiers::SHIFT)
+        );
     }
 
     #[test]
     fn test_multiple_modifiers() {
         assert_eq!(
             parse_key_event("ctrl-alt-a").unwrap(),
-            KeyEvent::new(KeyCode::Char('a'), KeyModifiers::CONTROL | KeyModifiers::ALT)
+            KeyEvent::new(
+                KeyCode::Char('a'),
+                KeyModifiers::CONTROL | KeyModifiers::ALT
+            )
         );
 
         assert_eq!(
@@ -485,7 +535,10 @@ mod tests {
     #[test]
     fn test_reverse_multiple_modifiers() {
         assert_eq!(
-            key_event_to_string(&KeyEvent::new(KeyCode::Char('a'), KeyModifiers::CONTROL | KeyModifiers::ALT)),
+            key_event_to_string(&KeyEvent::new(
+                KeyCode::Char('a'),
+                KeyModifiers::CONTROL | KeyModifiers::ALT
+            )),
             "ctrl-alt-a".to_string()
         );
     }
@@ -498,8 +551,14 @@ mod tests {
 
     #[test]
     fn test_case_insensitivity() {
-        assert_eq!(parse_key_event("CTRL-a").unwrap(), KeyEvent::new(KeyCode::Char('a'), KeyModifiers::CONTROL));
+        assert_eq!(
+            parse_key_event("CTRL-a").unwrap(),
+            KeyEvent::new(KeyCode::Char('a'), KeyModifiers::CONTROL)
+        );
 
-        assert_eq!(parse_key_event("AlT-eNtEr").unwrap(), KeyEvent::new(KeyCode::Enter, KeyModifiers::ALT));
+        assert_eq!(
+            parse_key_event("AlT-eNtEr").unwrap(),
+            KeyEvent::new(KeyCode::Enter, KeyModifiers::ALT)
+        );
     }
 }
diff --git a/node-launchpad/src/tui.rs b/node-launchpad/src/tui.rs
index 4ddfb19a8c..3c4643e253 100644
--- a/node-launchpad/src/tui.rs
+++ b/node-launchpad/src/tui.rs
@@ -15,8 +15,8 @@ use color_eyre::eyre::Result;
 use crossterm::{
     cursor,
     event::{
-        DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture, Event as CrosstermEvent,
-        KeyEvent, KeyEventKind, MouseEvent,
+        DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture,
+        Event as CrosstermEvent, KeyEvent, KeyEventKind, MouseEvent,
     },
     terminal::{EnterAlternateScreen, LeaveAlternateScreen},
 };
@@ -73,7 +73,17 @@ impl Tui {
         let task = tokio::spawn(async {});
         let mouse = false;
         let paste = false;
-        Ok(Self { terminal, task, cancellation_token, event_rx, event_tx, frame_rate, tick_rate, mouse, paste })
+        Ok(Self {
+            terminal,
+            task,
+            cancellation_token,
+            event_rx,
+            event_tx,
+            frame_rate,
+            tick_rate,
+            mouse,
+            paste,
+        })
     }
 
     pub fn tick_rate(mut self, tick_rate: f64) -> Self {
diff --git a/node-launchpad/src/utils.rs b/node-launchpad/src/utils.rs
index de891be601..f23e683cdf 100644
--- a/node-launchpad/src/utils.rs
+++ b/node-launchpad/src/utils.rs
@@ -13,17 +13,29 @@ use directories::ProjectDirs;
 use lazy_static::lazy_static;
 use tracing::error;
 use tracing_error::ErrorLayer;
-use tracing_subscriber::{self, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt, Layer};
-
-const VERSION_MESSAGE: &str =
-    concat!(env!("CARGO_PKG_VERSION"), "-", env!("VERGEN_GIT_DESCRIBE"), " (", env!("VERGEN_BUILD_DATE"), ")");
+use tracing_subscriber::{
+    self, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt, Layer,
+};
+
+const VERSION_MESSAGE: &str = concat!(
+    env!("CARGO_PKG_VERSION"),
+    "-",
+    env!("VERGEN_GIT_DESCRIBE"),
+    " (",
+    env!("VERGEN_BUILD_DATE"),
+    ")"
+);
 
 lazy_static! {
     pub static ref PROJECT_NAME: String = env!("CARGO_CRATE_NAME").to_uppercase().to_string();
     pub static ref DATA_FOLDER: Option<PathBuf> =
-        std::env::var(format!("{}_DATA", PROJECT_NAME.clone())).ok().map(PathBuf::from);
+        std::env::var(format!("{}_DATA", PROJECT_NAME.clone()))
+            .ok()
+            .map(PathBuf::from);
     pub static ref CONFIG_FOLDER: Option<PathBuf> =
-        std::env::var(format!("{}_CONFIG", PROJECT_NAME.clone())).ok().map(PathBuf::from);
+        std::env::var(format!("{}_CONFIG", PROJECT_NAME.clone()))
+            .ok()
+            .map(PathBuf::from);
     pub static ref LOG_ENV: String = format!("{}_LOGLEVEL", PROJECT_NAME.clone());
     pub static ref LOG_FILE: String = format!("{}.log", env!("CARGO_PKG_NAME"));
 }
@@ -34,7 +46,10 @@ fn project_directory() -> Option<ProjectDirs> {
 
 pub fn initialize_panic_handler() -> Result<()> {
     let (panic_hook, eyre_hook) = color_eyre::config::HookBuilder::default()
-        .panic_section(format!("This is a bug. Consider reporting it at {}", env!("CARGO_PKG_REPOSITORY")))
+        .panic_section(format!(
+            "This is a bug. Consider reporting it at {}",
+            env!("CARGO_PKG_REPOSITORY")
+        ))
         .capture_span_trace_by_default(false)
         .display_location_section(false)
         .display_env_section(false)
@@ -59,7 +74,8 @@ pub fn initialize_panic_handler() -> Result<()> {
 
             let file_path = handle_dump(&meta, panic_info);
             // prints human-panic message
-            print_msg(file_path, &meta).expect("human-panic: printing error message to console failed");
+            print_msg(file_path, &meta)
+                .expect("human-panic: printing error message to console failed");
             eprintln!("{}", panic_hook.panic_report(panic_info)); // prints color-eyre stack trace to stderr
         }
         let msg = format!("{}", panic_hook.panic_report(panic_info));
@@ -120,7 +136,10 @@ pub fn initialize_logging() -> Result<()> {
         .with_target(false)
         .with_ansi(false)
         .with_filter(tracing_subscriber::filter::EnvFilter::from_default_env());
-    tracing_subscriber::registry().with(file_subscriber).with(ErrorLayer::default()).init();
+    tracing_subscriber::registry()
+        .with(file_subscriber)
+        .with(ErrorLayer::default())
+        .init();
     Ok(())
 }