-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] Add the command usage syntax hint, inline
- Loading branch information
1 parent
a3f49fc
commit c144283
Showing
4 changed files
with
154 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
export type SyntaxPart = { | ||
syntax: string; | ||
doc: string; | ||
}; | ||
|
||
export type CommandSyntax = { | ||
parts: SyntaxPart[]; | ||
}; | ||
|
||
export type SyntaxMap = { | ||
[command: string]: CommandSyntax; | ||
}; | ||
|
||
export const syntaxMap: SyntaxMap = { | ||
SET: { | ||
parts: [ | ||
{ | ||
syntax: 'Key', | ||
doc: 'The key under which to store the value', | ||
}, | ||
{ | ||
syntax: 'Value', | ||
doc: 'The value to be stored', | ||
}, | ||
{ | ||
syntax: '[NX | XX]', | ||
doc: 'NX - Only set if key does not exist. XX - Only set if key exists', | ||
}, | ||
{ | ||
syntax: | ||
'[EX seconds | PX milliseconds | EXAT unix-time-seconds | PXAT unix-time-milliseconds | KEEPTTL]', | ||
doc: 'Options to set the key expiration: EX (seconds), PX (milliseconds), EXAT/PXAT (unix timestamp), or KEEPTTL to retain existing TTL', | ||
}, | ||
], | ||
}, | ||
GET: { | ||
parts: [ | ||
{ | ||
syntax: 'Key', | ||
doc: 'Key of the value you want to retrive', | ||
}, | ||
], | ||
}, | ||
DEL: { | ||
parts: [ | ||
{ | ||
syntax: 'Key', | ||
doc: 'Key that you want to delete', | ||
}, | ||
{ | ||
syntax: '[Key ...]', | ||
doc: 'Multiple keys you want to delete', | ||
}, | ||
], | ||
}, | ||
}; |