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

[feature request] reflect to class like python-fire #2229

Closed
loynoir opened this issue Aug 23, 2022 · 1 comment
Closed

[feature request] reflect to class like python-fire #2229

loynoir opened this issue Aug 23, 2022 · 1 comment

Comments

@loynoir
Copy link

loynoir commented Aug 23, 2022

https://github.com/google/python-fire

import fire

class Calculator(object):
  """A simple calculator class."""

  def double(self, number):
    return 2 * number

if __name__ == '__main__':
  fire.Fire(Calculator)
python calculator.py double 10  # 20
python calculator.py double --number=15  # 30
class Calculator {
  constructor() {}

  /**
   * 
   * @param {number} number
   * @returns 
   */
  double(number) {
    // arguments are casted base on jsdoc type
    // if jsdoc not found, guess value type
    return 2 * number
  }
}

yargs(hideBin(process.argv)).fire(Calculator).argv
node calculator.mjs double 10  # 20
node calculator.mjs double --number=15  # 30
@loynoir loynoir changed the title [feature request] yargs.fire [feature request] reflect to class like python-fire Aug 23, 2022
@shadowspawn
Copy link
Member

Interesting library, thanks for the link. I think it would be a serious amount of work to do the reflection, and Yargs has a lot invested in a different API.

This issue has not had any activity in over six months. It isn't likely to get acted on due to this report.

Feel free to open a new issue if it comes up again, with new information and renewed interest.

Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants