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

support multiple data flag usage #192

Merged
merged 2 commits into from
Oct 22, 2022
Merged

Conversation

reubenmiller
Copy link
Owner

@reubenmiller reubenmiller commented Oct 22, 2022

Change data flag from string to stringArray which allows the user to use data flag multiple times in the same command. This makes the command a bit more readable when setting multiple fields.

Example

Create a new device

Create a new device my combining the template and data usage. Use multiple data flags to make the command a bit more readable as it can be split across multiple lines.

c8y devices create \
    --name "Test device" \
    --template "{c8y_SupportedOperations:['c8y_Command', 'c8y_Restart']}" \
    --data "subtypes=[linuxA,linuxB]" \
    --data "c8y_Hardware.model=linux" \
    --data "c8y_Hardware.serial=abcdef" \
    --dry

Body

{
  "c8y_Hardware": {
    "model": "linux",
    "serial": "abcdef"
  },
  "c8y_IsDevice": {},
  "c8y_SupportedOperations": ["c8y_Command", "c8y_Restart"],
  "name": "Test device",
  "subtypes": ["linuxA", "linuxB"]
}

@reubenmiller reubenmiller merged commit 17b097a into v2 Oct 22, 2022
@reubenmiller reubenmiller deleted the feat/data-flag-use-string-array branch October 22, 2022 15:54
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.

1 participant