You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cli.js 499B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env node
  2. 'use strict';
  3. var getStdin = require('get-stdin');
  4. var meow = require('meow');
  5. var lpadAlign = require('./');
  6. var cli = meow({
  7. help: [
  8. 'Usage',
  9. ' $ cat <file> | lpad-align',
  10. '',
  11. 'Example',
  12. ' $ cat unicorn.txt | lpad-align',
  13. ' foo',
  14. ' foobar',
  15. ' foobarcat'
  16. ]
  17. }, {
  18. default: {
  19. indent: 4
  20. }
  21. });
  22. getStdin(function (data) {
  23. var arr = data.split(/\r?\n/);
  24. arr.forEach(function (el) {
  25. console.log(lpadAlign(el, arr, cli.flags.indent));
  26. });
  27. });