Giter Club home page Giter Club logo

nodejs-cli-apps-best-practices's People

Contributors

1wkk avatar allcontributors[bot] avatar andrii-bodnar avatar blzsaa avatar davesag avatar github-actions[bot] avatar gitlocalize-app[bot] avatar jasonkarns avatar josejpr avatar lirantal avatar lzm0x219 avatar m-sureshraj avatar michalporag avatar saadfrhan avatar shadowspawn avatar shamimshahraeini avatar simonplend avatar terkelg avatar thekhanj avatar urielofir avatar webfansplz avatar wildeyes avatar

Stargazers

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

Watchers

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

nodejs-cli-apps-best-practices's Issues

New Practice: Distinguish STDOUT from STDERR

I was about to open a PR that adds notes specific to distinguishing STDOUT from STDERR. However, the concept would have been dispersed among many other items:

  • Enable structured output
  • Informational errors
  • Provide debug mode

As the topic of stdout vs stderr is big enough, I think it probably warrants its own line-item.

Key point: STDERR is for more than just error output. It's for all diagnostic output.

New Experience best practice request: help

Would be nice if someone would like to contribute a section on CLIs supporting help.

My points to make would be:

  • A CLI should support -h and --help to provide help
  • A CLI should show this help if it is ran without arguments (unless it is possible for it to execute well without them)
  • Provide help for sub-commands when those are being used
  • When conflicting args are both provided a clear message should indicate so

This all should be embodied in one item about supporting help.

New feature: document other CLI related resources

Document other resources like:

  1. https://clig.dev/
  2. https://primer.style/cli/getting-started/principles

as additional educational material


Expected scope of work for this issue:

  • The README currently has 8 sections
  • Let's add a new section called: 10 Appendix: CLI educational resources
  • In it, let's document the above suggested resources
  • Let's not do the other section's format of "DO and OTHERWISE" because it doesn't fit. Instead, should we use a table to document them with some other properties, or perhaps just a bulleted list? Happy to go with whatever makes the most sense and we can change later.

Updating layout suggestions

What are your thoughts around organizing the layouts a bit differently?

Some feedback I received is around:

  • Getting rid of the collapsible content such as in Details or Recommended packages part and then just defaulting to that content being visible straight-out.
  • Adding a TL;DR for the top of the guide instead of the short intro, is that more helpful or not much of a change of what we have today?
  • Should we add more space between items and also between end/beginning of sections?
  • I want to add a contributors section too based on https://allcontributors.org/

remove 2.3 Cleanup configuration files chapter as it does not work since npm v7

As written in https://docs.npmjs.com/cli/v8/using-npm/scripts#a-note-on-a-lack-of-npm-uninstall-scripts the uninstall lifecycle scripts are not implemented and will not function since v7. Due to that chapter 2.3 Cleanup configuration files chapter should be removed as it does not work since npm v7

According to https://nodejs.org/en/about/releases/

  • node 14 the maintenance LTS, which comes with npm v6, is supported until 2023-04-30.
  • node 16 the active LTS, which comes with npm v8, is supported until 2024-04-30.

GitLocalize: Problems with the structure of the .md file

Hi everyone,

GitLocalize is giving me some trouble after a few weeks of inactivity in Spanish translations. It seems it isn´t maintaining the structure of the .md file.

Has anyone had this problem? How have they solved it?

Captura de pantalla 2020-06-16 a las 7 48 09

My idea to solve it would be in this case not to work via GitLocalize and create a PR.

Upgrade severals examples from require to import.

What do you think about change the import type of the modules from "require" to "import"? The new versions of NodeJS we can already work like this.

For example: https://github.com/lirantal/nodejs-cli-apps-best-practices#31-accept-input-as-stdin

import readline from "readline";

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.question("What do you think of Node.js? ", answer => {
// TODO: Log the answer in a database
console.log(`Thank you for your valuable feedback: ${answer}`);

rl.close();
});

Caveat: Accept STDIN somewhat counter to Empathetic CLI

As a counterpoint to the suggestion with 'empathetic CLIs', having a CLI that may suddenly block for STDIN is not friendly or empathetic. It does not account for an invocation that be run un-attended (ie on a build server, or scheduled cron job). Indeed, I would go so far as to say that any single CLI command should always be interactive or never be interactive; not sometimes.

It's also worth noting that an invocation that has STDOUT piped to its STDIN will start consuming that STDIN as if from the user if it attempts to switch to interactive mode based on some ambiguity. That is almost certainly not what the author nor user wants.

New Experience best practice request: version information

Looking for someone who would be interesting to contribute a new item on proper version usage.

My take on it would be around:

  • A program should support --version and -v to inspect the installed version

Further info that can be elaborated in details: A program may choose to show its version when being run in order to easily surface the version to users. Example of this is Yarn.

Good first issue: add Crowdin badge to the repository

Add the following badge to the repository which refers to the Crowdin translation service this repository uses:

[![Crowdin](https://badges.crowdin.net/nodejs-cli-apps-best-practices/localized.svg)](https://crowdin.com/project/nodejs-cli-apps-best-practices)

New feature: document a new section for popular command line frameworks

Feature a new section to include popular tools to build CLIs, such as:

  1. oclif
  2. inquirer
  3. ink
  4. blessed

Expected scope of work for this issue:

  • The README currently has 8 sections
  • Let's add a new section called: 9 Appendix: CLI Frameworks
  • In it, let's document the above suggested frameworks
  • Let's not do the other section's format of "DO and OTHERWISE" because it doesn't fit. Instead, I suggest we create a table with the library name, another column for the npm package, and another column for the github repo. We can add another column that has badges of current stars and npm downloads. Anything else you can think of that would be helpful?

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.