Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

fix: add explicit table.Flags type #153

Merged
merged 1 commit into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"fancy-test": "^1.4.1",
"mocha": "^5.2.0",
"ts-node": "^8.0.3",
"typescript": "^3.1.4"
"typescript": "^3.8.3"
},
"engines": {
"node": ">=8.0.0"
Expand Down
3 changes: 2 additions & 1 deletion src/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ function getPrompt(name: string, type?: string, defaultValue?: string) {
async function single(options: IPromptConfig): Promise<string> {
const raw = process.stdin.isRaw
if (process.stdin.setRawMode) process.stdin.setRawMode(true)
const response = await normal({required: false, ...options})
options.required = options.required ?? false
const response = await normal(options)
if (process.stdin.setRawMode) process.stdin.setRawMode(Boolean(raw))
return response
}
Expand Down
12 changes: 11 additions & 1 deletion src/styled/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,18 @@ class Table<T extends object> {
export function table<T extends object>(data: T[], columns: table.Columns<T>, options: table.Options = {}) {
new Table(data, columns, options).display()
}

export namespace table {
export const Flags = {
export const Flags: {
columns: F.IOptionFlag<string | undefined>;
sort: F.IOptionFlag<string | undefined>;
filter: F.IOptionFlag<string | undefined>;
csv: F.IFlag<boolean>;
output: F.IOptionFlag<string | undefined>;
extended: F.IFlag<boolean>;
'no-truncate': F.IFlag<boolean>;
'no-header': F.IFlag<boolean>;
} = {
columns: F.string({exclusive: ['extended'], description: 'only show provided columns (comma-separated)'}),
sort: F.string({description: 'property to sort by (prepend \'-\' for descending)'}),
filter: F.string({description: 'filter property by partial string matching, ex: name=foo'}),
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1607,10 +1607,10 @@ type-fest@^0.8.1:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==

typescript@^3.1.4:
version "3.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977"
integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==
typescript@^3.8.3:
version "3.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.2.tgz#64e9c8e9be6ea583c54607677dd4680a1cf35db9"
integrity sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==

universalify@^0.1.0:
version "0.1.2"
Expand Down