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

refactor: convert devices:commands command to yargs #690

Merged
merged 1 commit into from
Feb 25, 2025

Conversation

rossiam
Copy link
Collaborator

@rossiam rossiam commented Feb 24, 2025

  • converted devices:commands to yargs
  • split some code out into a module
  • unit tests will be written later
  • (an issue has been written to look into cleaning up some inconsistencies in this command; do unit tests after this)

@rossiam rossiam requested a review from a team February 24, 2025 16:30
Copy link

changeset-bot bot commented Feb 24, 2025

⚠️ No Changeset found

Latest commit: 9a0e52b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

],
[
'$0 devices:commands 6d73e4d1-3278-44d4-915a-099a62f05330 \'switchLevel:setLevel(50)\'',
'send the "setLevel" command passing 50 as an argument for the "switch" capability to the specified device' +
Copy link
Collaborator

Choose a reason for hiding this comment

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

switchLevel capability

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch! Fixed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(I also cleaned up the text in the note.)

})).component

if (isIndexArgument(input)) {
cmd.component = device.components[Number.parseInt(input) - 1].id || ''
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh jeez... and maybe this is totes fine. but is input safe to -1?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Probably not but this is just moved code and I've written an issue to address issues with it already.

@rossiam rossiam force-pushed the yargs-devices-commands branch from c3b1ff6 to 9a0e52b Compare February 25, 2025 16:04
@rossiam rossiam merged commit 07fd8b7 into SmartThingsCommunity:yargs Feb 25, 2025
4 checks passed
@rossiam rossiam deleted the yargs-devices-commands branch February 25, 2025 16:18
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.

2 participants