Giter VIP home page Giter VIP logo

loopback-console's People

Contributors

doublemarked 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

Watchers

 avatar  avatar  avatar  avatar

loopback-console's Issues

async/await promise exception output broken

my app uses es7 async await all over the place with try/catch exception handling in the async/await code. When an exception is thrown in the console the output is mangled. The exception message is output as an array instead of a string or something. example below.

2018-05-18T00:37:18.074Z [45470] ============================================
Loopback Console

Primary handles available:
 - app: The Loopback app handle
 - cb: A simplistic results callback that stores and prints
 - result: The handle on which cb() stores results

Other handles available:
  - Models: AccessToken, Affiliate, Announcement, APIKey, Application, Broker, Chat, ChatChannel, ConnectedUsers, Email, Error, Execution, Funding, IndexComposite, Instrument, InstrumentInterval, Insurance, Leaderboard, Liquidation, LiquidationOrder, LoginRecord, Margin, Notification, Order, OrderBook, OrderBookL2, Position, Quote, RoleMapping, Role, Scope, Schema, Secret, Settlement, Stats, StatsHistory, StatsUSD, Trade, TradeBin, Transaction, User, UserCommission, UserPreferences, Wallet, Webhook, accessToken, roleMapping, user
============================================


Loopback-console >User.new(
...         '[email protected]',
...         'hadof78909ads8f',
...         'testuserfromconsole',
...         'user1',
...         'testuser',
...         true,
...         null,
...         'US'
...       );
2018-05-18T00:37:32.425Z [45470] Error during creation of user testuserfromconsole[[email protected]](75633): undefined
2018-05-18T00:37:33.990Z [45470] [Promise Rejection]
OperationalError {
  '0': 'c',
  '1': 'o',
  '2': 'n',
  '3': 'n',
  '4': 'e',
  '5': 'c',
  '6': 't',
  '7': ' ',
  '8': 'E',
  '9': 'C',
  '10': 'O',
  '11': 'N',
  '12': 'N',
  '13': 'R',
  '14': 'E',
  '15': 'F',
  '16': 'U',
  '17': 'S',
  '18': 'E',
  '19': 'D',
  '20': ' ',
  '21': '1',
  '22': '2',
  '23': '7',
  '24': '.',
  '25': '0',
  '26': '.',
  '27': '0',
  '28': '.',
  '29': '1',
  '30': ':',
  '31': '4',
  '32': '6',
  '33': '5',
  cause: { '0': 'c',
     '1': 'o',
     '2': 'n',
     '3': 'n',
     '4': 'e',
     '5': 'c',
     '6': 't',
     '7': ' ',
     '8': 'E',
     '9': 'C',
     '10': 'O',
     '11': 'N',
     '12': 'N',
     '13': 'R',
     '14': 'E',
     '15': 'F',
     '16': 'U',
     '17': 'S',
     '18': 'E',
     '19': 'D',
     '20': ' ',
     '21': '1',
     '22': '2',
     '23': '7',
     '24': '.',
     '25': '0',
     '26': '.',
     '27': '0',
     '28': '.',
     '29': '1',
     '30': ':',
     '31': '4',
     '32': '6',
     '33': '5',
     error: undefined,
     errno: 'ECONNREFUSED',
     code: 'ECONNREFUSED',
     syscall: 'connect',
     address: '127.0.0.1',
     port: 465 },
  __cachedRelations: {},
  __data:
   { '0': 'c',
     '1': 'o',
     '2': 'n',
     '3': 'n',
     '4': 'e',
     '5': 'c',
     '6': 't',
     '7': ' ',
     '8': 'E',
     '9': 'C',
     '10': 'O',
     '11': 'N',
     '12': 'N',
     '13': 'R',
     '14': 'E',
     '15': 'F',
     '16': 'U',
     '17': 'S',
     '18': 'E',
     '19': 'D',
     '20': ' ',
     '21': '1',
     '22': '2',
     '23': '7',
     '24': '.',
     '25': '0',
     '26': '.',
     '27': '0',
     '28': '.',
     '29': '1',
     '30': ':',
     '31': '4',
     '32': '6',
     '33': '5',
     error: undefined,
     errno: 'ECONNREFUSED',
     code: 'ECONNREFUSED',
     syscall: 'connect',
     address: '127.0.0.1',
     port: 465 },
  __dataSource: undefined,
  __strict: false,
  __persisted: false,
  errno: 'ECONNREFUSED',
  code: 'ECONNECTION',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 465,
  command: 'CONN' }
Loopback-console >2018-05-18T00:37:49.010Z [45470] 127.0.0.1 (Chrome 65.0.3325.181, Mac OS)  - "GET /api/v1/geo " 404 9b - 177.891 ms

How to display console.log ?

Hi,

I would like to use loopback-console to trigger manually scripts that may take a long time. Is there a way to show progress (console.log / process.stdout.write) in the REPL ?

Or if you eventually had another suggestion as on how to do the following I'd be more than happy. What I need is :

  • Start scripts from the CLI that need to display updated information before script ends
  • Access LB models and app from these scripts

Doesn't sound much complicated but I guess I am missing some ExpressJS basics...

Help would be much appreciated, thanks

Can I use it on Windows?

Hi!

I tried to use it on my Windows 8.1 x64 and got an error.

package.json:

 "scripts": {
    "console": "$(npm bin)/loopback-console ."
  }

Output:

> $(npm bin)/loopback-console .

"$" Is not an internal or external
command, operable program or batch file.

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "console"
npm ERR! node v0.12.7
npm ERR! npm  v3.2.0
npm ERR! code ELIFECYCLE
npm ERR! [email protected] console: `$(npm bin)/loopback-console .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] console script '$(npm bin)/loopback-console .'.
npm ERR! This is most likely a problem with the loopback-zero-to-hero package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     $(npm bin)/loopback-console .
npm ERR! You can get their info via:
npm ERR!     npm owner ls loopback-zero-to-hero
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\projects\loopback-zero-to-hero\npm-debug.log

add a help command to the REPL

$ loopback-console .
...
loopback > help
ReferenceError: help is not defined
loopback > models
ReferenceError: models is not defined

There should be a way to see the help again which right now only pops-up in the beginning and then gets lost as the screen scrolls up ... and probably something called models also, it helps when someone only wants all the existing models listed.

How to use with ES6 syntax app?

What strategy can I take to integrate this into a ES6 app that uses import statements?

$ ./node_modules/.bin/loopback-console
/Users/kevzettler//api/app.js:3
import {generateConfig} from 'etc/environment';
^^^^^^

SyntaxError: Unexpected token import
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)

Multiline command doesn't work?

In Node Repl, I can run the following short script but in loopback console it ends with SyntaxError.

if (1) {
  console.log('Hello');
}

Any config change which I am missing here?

Need more examples

  1. Consider adding an example directory inside loopback-console which was ignored for publishing with .npmignore but used by those who clone this project to quickly experiment a slew of HOW-TOs on usage for loopback-console
  2. Add lots of command-line examples to show people how they can make the most of this tool

Error using v0.2.2 w/ Node v0.10

loopback > 
/Users/pulkitsinghal/.nvm/v0.10.37/lib/node_modules/loopback-console/index.js:123
        throw(err);
              ^
TypeError: Cannot call method 'bind' of undefined
    at /Users/pulkitsinghal/.nvm/v0.10.37/lib/node_modules/loopback-console/repl.js:21:44
    at REPLServer.self.eval (repl.js:122:7)
    at Object.module.exports.start (/Users/pulkitsinghal/.nvm/v0.10.37/lib/node_modules/loopback-console/repl.js:19:16)
    at Object.module.exports.start (/Users/pulkitsinghal/.nvm/v0.10.37/lib/node_modules/loopback-console/index.js:96:21)
    at Object.module.exports.cli (/Users/pulkitsinghal/.nvm/v0.10.37/lib/node_modules/loopback-console/index.js:118:22)
    at Object.<anonymous> (/Users/pulkitsinghal/.nvm/v0.10.37/lib/node_modules/loopback-console/bin/loopback-console:3:15)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:935:3

Support async/await

Is it possible to wrap the console prompt in an async IIFE, so that we can use await inside?

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.