parallaxinc / PropLoader

Parallax Propeller loader supporting both serial and wifi downloads
MIT License
27 stars 13 forks source link

Module name is not allowed to contains spaces #8

Closed PropGit closed 8 years ago

PropGit commented 8 years ago

Spaces are being stripped out of the module name.

Using proploader -i <ipaddress> -n "My Wi-Fi Module" results in the module being named "My" instead.

PropGit commented 8 years ago

I see that the module name is stored as the module's Hostname.

If it's not possible for hostnames to have spaces (and I believe it is not allowed) then please make proploader automatically convert any white space (spaces) in the given name to underscores (_). For this reason, it should probably finish up the module naming operation with a success message (related to Issue #10) saying something like: "Set module name to ''"

dbetz commented 8 years ago

Should we add a new field to the config structure to contain the "friendly name" so that we can relax the requirement to allow spaces? I just used hostname because it was a field that was already present.

PropGit commented 8 years ago

No, I like your decision to use hostname because it makes it show up in other network areas too; like the AP's Wi-Fi client list.

Let's just make proploader automatically:

  1. trim any leading and trailing whitespace (spaces, tabs, non-printable characters), and,
  2. convert any non-leading/trailing whitespace characters to underscores (_), then,
  3. upon success, report "Set module name to < hostname >" for clarity in what occurred
dbetz commented 8 years ago

I've modified proploader to enforce the following rules:

Module names should only include the characters A-Z, a-z, 0-9, or '-' and should not begin or end with a '-'. They must also be less than 32 characters long.

In addition, it will attempt to convert any name provided by the user to a compliant name by replacing spaces with hyphens.