atsign-foundation / noports

Connect to any device with no external listening ports open
https://noports.com
BSD 3-Clause "New" or "Revised" License
263 stars 15 forks source link

Install 0 device names during universal.sh installation process causes np.sh to exit #1176

Open JeremyTubongbanua opened 3 days ago

JeremyTubongbanua commented 3 days ago

Describe the bug

During universal.sh installation (client) on M2 MacBook Air ARM

I provided 0 device names

I pressed "enter" as soon as it asked me for a device name.

Then, when I tried to run /usr/local/bin/np.sh, it provided:

Select a device (enter the number):
No device selected

Expecting a better user experience.

Steps to reproduce

Enter device atSign: @soccer99
Pick your default region:
  am   : Americas
  ap   : Asia Pacific
  eu   : Europe
  @___ : Specify a custom region atSign
Region: am
Installing a quick picker script to make it easy to connect to devices...
Type a device name and press enter to submit it.
Press enter once more to finish.
Device name: 
Run /usr/local/bin/np.sh to get your quick pick of devices to connect to.
jeremytubongbanua@Jeremys-MacBook-Air temp % /usr/local/bin/np.sh
Select a device (enter the number):
No device selected

Expected behavior

Provide bette instructions on what to do if no device names were installed during universal.sh installation process

Screenshots

jeremytubongbanua@Jeremys-MacBook-Air temp % cat /usr/local/bin/np.sh
#!/bin/bash
# SCRIPT METADATA
binary_path="$HOME/.local/bin"
client_atsign="@jeremy_0"
device_atsign="@soccer99"
host_atsign="@rv_am"
devices=()
additional_args=()
# END METADATA

unset d
echo "Select a device (enter the number):"
select d in "${devices[@]}"; do
    break
done

if [ -z "$d" ]; then
    echo "No device selected"
    exit 1
fi

echo "Executing $binary_path"/sshnp -f "$client_atsign" -t "$device_atsign" -h "$host_atsign" -d "$d" "${additional_args[@]}" "$@"
"$binary_path"/sshnp -f "$client_atsign" -t "$device_atsign" -h "$host_atsign" -d "$d" "${additional_args[@]}" "$@"

Smartphones

No response

Were you using an atApplication when the bug was found?

No response

Additional context

No response