snapp_cli 0.4.4 copy "snapp_cli: ^0.4.4" to clipboard
snapp_cli: ^0.4.4 copied to clipboard

snapp_cli is a Dart command-line tool designed to simplify the process of adding custom devices to the Flutter SDK.

Snapp Embedded
Platforms
Pub Version Pub points Pub Likes Pub popularity
Repo PRs Repo issues Repo stars Contributors License

snapp_cli #

snapp_cli is a powerful command-line interface tool designed to simplify the integration of embedded devices (like Raspberry Pi) with Flutter applications. Effortlessly manage your embedded devices, establish secure SSH connections, and streamline the development process by installing Flutter directly onto your custom devices from your PC.

Features #

  • πŸ› οΈ Single Command Setup: Prepare your custom device completely by adding it to Flutter, establishing SSH connection, installing Flutter, and running your appβ€”all with a single command.
  • πŸ“± Device Management: Add, list, and remove custom(embedded) devices effortlessly.
  • πŸ”’ Automatic SSH Connection: Configure and establish SSH connections to devices with ease.
  • πŸš€ Flutter Installation: Install Flutter directly onto your custom devices from your PC.
  • πŸ”₯ Run & Debug Flutter Apps: Utilize hot reload, hot restart, and Dart DevTools for efficient app development.
  • πŸŽ›οΈ User-Friendly Interface: Intuitive CLI for seamless navigation and usage.

Installation #

Before using snapp_cli, ensure that you have Dart and Flutter installed. You can install the tool using the Dart package manager:

dart pub global activate snapp_cli

Make sure that system cache bin directory is added to your system's PATH to use snapp_cli globally. follow this link for more information: Running a script from your PATH

Usage #

Single Command Setup - Bootstrap

Bootstrap command is a way to setup a device from scratch. It will add a new device to custom devices, create a ssh connection to the device, install flutter on the device and finally help you to run your app on the device.

$ snapp_cli bootstrap

Device Management

  • List Devices: Display all connected/embedded devices.
    $ snapp_cli devices list
    
  • Add a Device: Add a new device to the Flutter SDK.
    $ snapp_cli devices add 
    
  • Delete a Device: Remove a device from the Flutter SDK.
    $ snapp_cli devices delete
    
  • Update Device IP: Update the IP address of a device.
    $ snapp_cli devices update-ip
    
  • Install Flutter: Install Flutter directly onto a device.
    $ snapp_cli devices install-flutter
    

SSH Connection

  • Create SSH Connection: Create a passwordless SSH connection to a device.
    $ snapp_cli ssh create-connection
    
  • Test SSH Connection: Test a passwordless SSH connection to a device.
    $ snapp_cli ssh test-connection
    

Each command has specific options and usage, which you can explore further by running snapp_cli --help or snapp_cli <command> --help.

Troubleshooting #

Running Commands in Verbose Mode #

If you encounter any issues while using the snapp_cli tool, you can run the commands in verbose mode to obtain more detailed information about the error. To do this, simply add the -v flag to your command. For example:

$ snapp_cli bootstrap -v

SSH Connection Issues #

Sometimes, you may face difficulties establishing an SSH connection to a device due to various reasons, such as an incorrect IP address, username, password, or SSH key. To verify whether the SSH connection is functioning correctly, you can execute the snapp_cli ssh test-connection command. If the connection fails, attempt to establish a new connection using the snapp_cli ssh create-connection command.

If you still cannot establish an SSH connection, it may be necessary to review the SSH configurations on both your host (e.g., your PC) and the remote device (e.g., Raspberry Pi).

However, be cautious: if you have any other SSH connections to your remote device or to other devices, using the following commands will remove them.

Host Device - Your PC

  • Clear the .snapp_cli directory:
    rm -r ~/.snapp_cli
    
  • Clear the known hosts file:
    ssh-keygen -R yourIpAddress
    
  • Clear the ssh-agent saved keys:
    ssh-add -D
    

Remote Device - Raspberry Pi

Connect to your remote device via a simple SSH connection:

ssh [username]@[ipAddress]

After successfully connecting to your remote device, remove the .ssh folder that contains the SSH keys:

rm -r ~/.ssh

Notes: #

  • Ensure you replace yourIpAddress with the actual IP address of your device.
  • Be explicit about replacing placeholders like username@ipAddress with the appropriate user and IP address for the Raspberry Pi.

Manually Editing flutter_custom_devices.json #

In some cases, you may need to manually edit the flutter_custom_devices.json file, which stores the configurations for custom devices. Here are the steps to follow if you encounter this situation:

  1. Locate the flutter_custom_devices.json File:

    • The location of the flutter_custom_devices.json file can vary depending on the operating system you are using. You can find it with the snapp_cli list command.
  2. Backup the File:

    • Before making any manual changes, it's a good practice to create a backup of the flutter_custom_devices.json file in case something goes wrong.
  3. Edit the JSON File:

    • Use a text editor to open the flutter_custom_devices.json file. You can make changes to the device configurations as needed. Ensure that the JSON structure is valid; any syntax errors can cause issues.
  4. Test the Configuration:

    • To test the changed configuration you need to run your app again.

Keep in mind that manually editing the flutter_custom_devices.json file should be done with caution, as incorrect changes can lead to configuration issues. It's recommended to use the CLI tool to add, update, or delete custom devices whenever possible.

Contributing #

If you encounter any issues with this package or have suggestions for improvements, please open an issue. You are welcome to contribute to the development of this project by forking the repository and submitting pull requests.

License #

This project is licensed under the MIT License

13
likes
0
pub points
14%
popularity

Publisher

verified publishersnappx.io

snapp_cli is a Dart command-line tool designed to simplify the process of adding custom devices to the Flutter SDK.

Repository (GitHub)
View/report issues

Topics

#cli #devices #embedded #raspberry #snapp

License

unknown (license)

Dependencies

args, async, collection, dartssh2, file, flutter_tools, interact_cli, mason_logger, package_config, path, process, pub_semver, pub_updater, tint, yaml

More

Packages that depend on snapp_cli