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

Dump files to the stdout if filename is specified. #562

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

supersuryaansh
Copy link

If file name is specified they will be dumped to the stdout, for example:

"pear:///path/to/file ." will dump to the stdout

let { dir } = cmd.args
if (!link) throw ERR_INVALID_INPUT('<link> must be specified.')
if (!dir) throw ERR_INVALID_INPUT('<dir> must be specified.')
dir = dir === '-' ? '-' : (isAbsolute(dir) ? dir : resolve('.', dir))
if (dir === '-') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dir === '-' || getFileNameFromPearUrl

Comment on lines +26 to +27
const pathParts = path.split('/')
return pathParts[pathParts.length - 1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the return value is not used you could return a boolean instead

@@ -118,8 +118,8 @@ module.exports = async (ipc, argv = Bare.argv.slice(1)) => {
const dump = command(
'dump',
summary('Synchronize files from key to dir'),
arg('<link>', 'Pear link to dump from, supports pathname'),
arg('<dir>', 'Directory path to dump to, may be - for stdout'),
arg('<link>', 'Pear link to dump from, supports pathname. Pathname will always dump the the stdout'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated "the" word

@@ -18,12 +18,36 @@ const output = outputter('stage', {
}
})

function getFileNameFromPearUrl(url) {
if (url.startsWith('pear://')) {
const urlParts = url.slice(7).split('/')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use https://github.com/holepunchto/pear-link instead of manual parsing

@rafapaezbas
Copy link
Contributor

please run npx standard --fix to reformat the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants