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

feat: support single-character flags #27

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'develop' of github.com:privatenumber/type-flag into sin…
…gle-character-flag
  • Loading branch information
privatenumber committed Jun 20, 2024
commit 6a19b1a48199e07899b0d86f7067be72fbd9d7d1
16 changes: 16 additions & 0 deletions tests/specs/type-flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,22 @@ export default testSuite(({ describe }) => {
expect(argv).toStrictEqual([]);
});

test('should not accept aliases with --', () => {
const argv = ['--a'];
const parsed = typeFlag(
{
alias: {
type: Boolean,
alias: 'a',
},
},
argv,
);
expect<boolean | undefined>(parsed.flags.alias).toBe(undefined);
expect<(string | boolean)[]>(parsed.unknownFlags.a).toStrictEqual([true]);
expect(argv).toStrictEqual([]);
});

test('single-character alias', () => {
const argv = ['-x', '1', '-y', '2'];
const parsed = typeFlag(
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.