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

cargo vdev build component-docs should require argument and more helpful message printed in misuse #16980

Open
jonathanpv opened this issue Mar 28, 2023 · 0 comments
Assignees
Labels
domain: ci Anything related to Vector's CI environment domain: vdev Anything related to the vdev tooling type: bug A code related bug.

Comments

@jonathanpv
Copy link
Contributor

jonathanpv commented Mar 28, 2023

Problem

The underlying ruby script running when calling cargo vdev build component-docs requires ARGV[0] to be the file path of the configuration schema:

if ARGV.empty?
  puts 'usage: extract-component-schema.rb <configuration schema path>'
  exit 1
end

# Ensure that Cue is present since we need it to import our intermediate JSON representation.
if @cue_binary_path.nil?
  puts 'Failed to find \'cue\' binary on the current path. Install \'cue\' (or make it available on the current path) and try again.'
  exit 1
end

schema_path = ARGV[0]
root_schema = JSON.parse(File.read(schema_path))

Currently we do not require any arguments when running this so the user must know before hand to pass in the file path. To prevent confusion we should add a required field, not utilize the script_wrapper macro, and provide a more helpful message than:

❯ cargo vdev build component-docs
usage: extract-component-schema.rb <configuration schema path>
Error: command: "/Users/jesse.szwedko/workspace/vector/scripts/generate-component-docs.rb"
  failed with exit code: 1

notice extract-component-schema.rb might confuse users since that is invoked when running cargo vdev buidl component-docs

Configuration

No response

Version

0.29.0

Debug Output

No response

Example Data

No response

Additional Context

No response

References

No response

@jonathanpv jonathanpv added the type: bug A code related bug. label Mar 28, 2023
@jonathanpv jonathanpv self-assigned this Mar 28, 2023
@jonathanpv jonathanpv added domain: vdev Anything related to the vdev tooling domain: ci Anything related to Vector's CI environment labels Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: ci Anything related to Vector's CI environment domain: vdev Anything related to the vdev tooling type: bug A code related bug.
Projects
None yet
Development

No branches or pull requests

1 participant