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

fix: cli options behavior #5

Open
sashasushko opened this issue Nov 9, 2022 · 0 comments
Open

fix: cli options behavior #5

sashasushko opened this issue Nov 9, 2022 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@sashasushko
Copy link
Contributor

We use commander.js for creating CLI. There is a strange behavior which more a bug than a feature.

When user makes a mistake and uses "-name" option instead "--name" commander is parsing it as "-n ame".

So, for the command

npx fontpie ./roboto-regular.ttf -name "Roboto"

our user gets

@font-face {
  font-family: 'ame';
               ^^^^^
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('examples/roboto-regular.ttf') format('truetype');
}

@font-face {
  font-family: 'ame Fallback';
               ^^^^^
  font-style: normal;
  font-weight: 400;
  src: local('Times New Roman');
  ascent-override: 84.57%;
  descent-override: 22.25%;
  line-gap-override: 0.00%;
  size-adjust: 109.71%;
}

html {
  font-family: 'ame', 'ame Fallback';
               ^^^^^
}

Acceptable fix

Show error to user in terminal and stop execution.

Ideal fix

Use font filename as font name in CSS and show notice to user in terminal.

@sashasushko sashasushko added bug Something isn't working good first issue Good for newcomers labels Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant