Giter Site home page Giter Site logo

billboard's Introduction

Hi there ๐Ÿ‘‹

I'm a devtools engineer! Check out averyharnish.com for my personal site.

Professional Repositories

In the past I've worked at Apollo GraphQL and Cloudflare.

At Apollo, I worked on the ๐Ÿค– Rover CLI. Related repositories are federation-rs, router, awc and apollo-rs.

At Cloudflare, I worked on v1 of the ๐Ÿค  Wrangler CLI. Related repositories are kv-asset-handler, worker-typescript-template, workers-docs, and worker-sites-template.

Open Source Repositories

I also maintain some open source Rust crates. Check out shell-candy if you want to shell out to a sub-process and handle their stdout/stderr as streams. Or, you can check out billboard if you want to display boxes with outlines in your terminal.

I also maintain binary-install which allows you to extract a binary from a tarball endpoint and shell out to it from node. It's not the best library out there and I'd love help modernizing it and rewriting it in TypeScript.


A photoshopped box of Everlasting Gobstoppers that says EverlastingBugstopper instead

billboard's People

Contributors

everlastingbugstopper avatar prasek avatar restyled-commits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

billboard's Issues

Add examples to documentation

There are overall examples in the examples directory, but there should also be good examples in the documentation.

Boxx layout is incorrect when text have ansi escape characters on it

Sometimes you want to put some color on the text inside of the Box.

Right now, if you do it Boxx will improperly calculate the length of the line where the colors are used.
See attached screenshot:

Screen Shot 2020-02-18 at 10 39 11 AM

Some code that can trigger this is:

let message = format!(
        "There's a new version of the software! {} โ†’ {}\nUpdate with {}",
       "11".red(),
        "12".green(),
        "software self-update".green().bold()
    );
Boxx::builder().border_style(BorderStyle::Round).build().display(&message);

I think this can be easily solved by using a "cleaning" function over the provided text to Boxx, so ansi characters are cleaned out, similar to the following implementation in JS:

/**
  This function removes the ansi escape characters
  (normally used for printing colors and so)
  Inspired by: https://github.com/chalk/ansi-regex/blob/master/index.js
  MIT License Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
 */
const cleanStdout = (stdout) => {
  const pattern = [
    "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
    "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
  ].join("|");

  const regexPattern = new RegExp(pattern, "g");
  return stdout.replace(regexPattern, "");
};

More context on the issue here: wasmerio/wapm-cli#169

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.