Skip to content

Option alias to short, bad error #791

Open
@Natejoestev

Description

@Natejoestev

Type of issue

Bug


My environment

OS: Windows 11 64 bit
Node: v18.1.0
Npm: 8.8.0
Yo: 4.3.1

Expected behavior

throw error like this:

Error (MY_GENERATOR)

Option (NAME) alias is to long.

NAME would be the first argument passed to the option function.

Current behavior

throws random error where this is undefined when calling a custom function on the generator.

Steps to reproduce the behavior

call option definition function with alias that is longer than 4 ish characters.

Command line output

Error (MY_GENERATOR) -myAlias option

Cannot read properties of undefined (reading 'usesPkgManager')

usesPkgManager is a function i defined on the custom generator to return a boolean whether it uses a packages manager.

note

it would be nice to document that the alias is required to be less than a certain length.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions