How to use tildify - 9 common examples

To help you get started, we’ve selected a few tildify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Chassis / Desktop / src / lib / formatPath.js View on Github external
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
github lukehorvat / screenshot-tweet / lib / cli.js View on Github external
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);
});
github mgcrea / node-easyrsa / src / bin / easyrsa.js View on Github external
function prettyPath(filepPath) {
  return chalk.magenta(tildify(filepPath));
}
github Chassis / Desktop / src / MachineSettings.js View on Github external
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 &gt; 1 ?
						
					:
						<input value="{" type="text"> onChange({ hosts: [ e.target.value ] }) }
						/&gt;
					}
				</label>
				<div></div></form>
github Chassis / Desktop / src / CreateModal / Config.js View on Github external
export default props =&gt; {
	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
github mehcode / atom-project-plus / lib / project-finder-view.js View on Github external
this.div({class: 'secondary-line'}, () => {
              this.text(tildify(pathname))
            })
          }
github LN-Zap / zap-desktop / lnd / config.js View on Github external
const safeTildify = (val: ?T): ?T =&gt; (typeof val === 'string' ? tildify(val) : val)
const safeUntildify = (val: ?T): ?T =&gt; (typeof val === 'string' ? untildify(val) : val)
github wulkano / kap / renderer / components / preferences / categories / general.js View on Github external
pickKapturesDir,
      setOpenOnStartup,
      cropperShortcut,
      updateShortcut,
      toggleShortcuts,
      category
    } = this.props;

    const {showCursorSupported} = this.state;

    const devices = audioDevices.map(device =&gt; ({
      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 &amp;&amp;
github Fitbit / webpack-cluster / src / CompilerStrategyMessages.js View on Github external
const userPath = filename => tildify(resolve(filename));

tildify

Convert an absolute path to a tilde path: `/Users/sindresorhus/dev` → `~/dev`

MIT
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis

Popular tildify functions