Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: relax restrictions on device name #1420

Merged
merged 3 commits into from
Oct 2, 2024
Merged

feat: relax restrictions on device name #1420

merged 3 commits into from
Oct 2, 2024

Conversation

gkc
Copy link
Contributor

@gkc gkc commented Oct 2, 2024

- What I did
Resolves #1403

- How I did it

  • Modified the invalidDeviceName function
  • Added a snakifyDeviceName function
  • Modified the CLI codepaths to call snakifyDeviceName before creating NptParams / SshnpParams
  • Added some unit tests

- How to verify it
Tests pass

- Additional context
Also made some changes to allow a slow unit test to run more rapidly

- allow hyphens in device name
- binaries (npt, sshnp) call new function snakifyDeviceName which
  - converts uppercase latin chars to lowercase
  - converts whitespace to underscores
…hat we can have a unit test that doesn't take 15 seconds

feat: modified default timeout of `getHostAndPortFromSrvd` to 20 seconds from 15 seconds
@gkc gkc marked this pull request as ready for review October 2, 2024 14:19
/// whitespace replaced with underscores. Note that multiple consecutive
/// whitespace characters will be replaced by a single underscore.
String snakifyDeviceName(String deviceName) {
return deviceName.toLowerCase().replaceAll(RegExp(r'\s+'), '_');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Snakify impl

@XavierChanth XavierChanth merged commit dbe086f into trunk Oct 2, 2024
9 checks passed
@gkc gkc deleted the feat-1403 branch October 16, 2024 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Device name '-d' to accept '-' and to accept uppercase but to lowercase everything.
2 participants