-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update dependencies - Apply new prettier defaults
- Loading branch information
1 parent
abfc01a
commit e0a93e3
Showing
8 changed files
with
114 additions
and
46 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "torrent-clean", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"description": "Removes files that are not specified in selected torrent file", | ||
"author": "Nikolay Borzov <[email protected]>", | ||
"license": "MIT", | ||
|
@@ -37,13 +37,13 @@ | |
"devDependencies": { | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.0", | ||
"eslint-config-standard": "^14.1.0", | ||
"eslint-config-prettier": "^6.10.1", | ||
"eslint-config-standard": "^14.1.1", | ||
"eslint-plugin-import": "^2.20.1", | ||
"eslint-plugin-node": "^11.0.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"prettier": "^1.19.1" | ||
"prettier": "^2.0.2" | ||
} | ||
} |
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,60 @@ | ||
const { MultiSelect } = require('enquirer') | ||
const utils = require('enquirer/lib/utils') | ||
|
||
module.exports = class FilesSelect extends MultiSelect { | ||
constructor(options) { | ||
super(options) | ||
|
||
this.digitsCount = (Math.log10(options.choices.length) + 1) | 0 | ||
} | ||
|
||
// https://github.com/enquirer/enquirer/blob/master/lib/prompts/select.js#L46 | ||
async renderChoice(choice, i) { | ||
await this.onChoice(choice, i) | ||
|
||
const focused = this.index === i | ||
const pointer = await this.pointer(choice, i) | ||
const check = (await this.indicator(choice, i)) + (choice.pad || '') | ||
let hint = await this.resolve(choice.hint, this.state, choice, i) | ||
|
||
if (hint && !utils.hasColor(hint)) { | ||
hint = this.styles.muted(hint) | ||
} | ||
|
||
const ind = this.indent(choice) | ||
let msg = await this.choiceMessage(choice, i) | ||
|
||
const choiceNumber = `${(choice.index + 1) | ||
.toString() | ||
.padStart(this.digitsCount)}|` | ||
|
||
const line = () => | ||
[ | ||
this.margin[3], | ||
ind + pointer + check, | ||
choiceNumber, | ||
msg, | ||
this.margin[1], | ||
hint, | ||
] | ||
.filter(Boolean) | ||
.join(' ') | ||
|
||
if (choice.role === 'heading') { | ||
return line() | ||
} | ||
|
||
if (choice.disabled) { | ||
if (!utils.hasColor(msg)) { | ||
msg = this.styles.disabled(msg) | ||
} | ||
return line() | ||
} | ||
|
||
if (focused) { | ||
msg = this.styles.em(msg) | ||
} | ||
|
||
return line() | ||
} | ||
} |
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