Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function formatPath(path) {
const tilded = tildify(path);
// Only shorten if longer than we want.
if ( tilded.length < 40 ) {
return tilded;
}
// Split into segments, and keep first and last two.
// https://blog.codinghorror.com/shortening-long-file-paths/
const segments = tilded.split( separator );
if ( segments.length < 5 ) {
return tilded;
}
return [
...segments.slice( 0, 2 ),
"\u2026", // Horizontal ellipsis
process.exit();
}
if (argv.version || argv.v) {
console.log(pkg.version);
process.exit();
}
if (argv._.length !== 2) {
yargs.showHelp();
console.error(chalk.red("Tweet URL and file path must be specified."));
process.exit(1);
}
let [ tweetUrl, filePath ] = argv._;
console.log(chalk.green(`Screenshotting tweet "${tweetUrl}" to "${tildify(filePath)}"...`));
screenshotTweet(
tweetUrl,
filePath
).then(() => {
console.log(chalk.green("Done!"));
process.exit();
}).catch(error => {
console.error(chalk.red(error));
process.exit(1);
});
function prettyPath(filepPath) {
return chalk.magenta(tildify(filepPath));
}
render() {
const { changes, machine, onChange, onDelete, onRefresh } = this.props;
const config = { ...machine.config, ...changes };
return <form>
<div>
<div>Path:</div>
<div>
<p>Paths cannot be changed once added.</p>
</div>
</div>
<label>
<div>Hosts:</div>
{ config.hosts.length > 1 ?
:
<input value="{" type="text"> onChange({ hosts: [ e.target.value ] }) }
/>
}
</label>
<div></div></form>
export default props => {
let message, buttonText, fields = [];
let chassisDirectory = props.path;
switch (props.type) {
case TYPES.CREATE:
message = <p>You are about to create a new Chassis install.</p>;
buttonText = 'Create';
break;
case TYPES.RETROFIT:
message = <p>You are adding Chassis to an existing WordPress installation.</p>;
fields.push(
<div>
<div>Project Directory:</div>
</div>
);
chassisDirectory += '/chassis';
buttonText = 'Create';
break;
case TYPES.IMPORT:
message = <p>You are adding an existing Chassis box to the list.</p>;
buttonText = 'Add';
break;
default:
return <p>Unknown type!</p>;
}
return
this.div({class: 'secondary-line'}, () => {
this.text(tildify(pathname))
})
}
const safeTildify = (val: ?T): ?T => (typeof val === 'string' ? tildify(val) : val)
const safeUntildify = (val: ?T): ?T => (typeof val === 'string' ? untildify(val) : val)
pickKapturesDir,
setOpenOnStartup,
cropperShortcut,
updateShortcut,
toggleShortcuts,
category
} = this.props;
const {showCursorSupported} = this.state;
const devices = audioDevices.map(device => ({
label: device.name,
value: device.id
}));
const kapturesDirPath = tildify(kapturesDir);
const tabIndex = category === 'general' ? 0 : -1;
const fpsOptions = [{label: '30 FPS', value: false}, {label: '60 FPS', value: true}];
return (
{
showCursorSupported &&
const userPath = filename => tildify(resolve(filename));