Coder Social home page Coder Social logo

slyft-cli's Introduction

slyft

command line client to slyft-server

Run slyft

To run slyft, fetch the appropriate release zip file, extract and run:

$ ./slyft

For a comprehensive documentation, please see www.slyft.io/docs

Build slyft

Before you begin, make sure you have Golang and Node.js installed. For the Go sources to build successfully, you also need $GOPATH and $GOBIN to be set (for this example, $GOPATH is set to ~/golang):

 $ cd
~$ mkdir -p golang/bin
~$ export GOPATH=~/golang
~$ export GOBIN=$GOPATH/bin

Then clone the repo to $GOPATH/src/github.com/thingforward/slyft-cli. That done, you can build slyft as follows:

$ sudo npm install --global gulp-cli
$ npm install 
$ gulp

This will create a binary for your platform in the folder bin and a zipped archive (e.g. dist/slyft-0.1.0-darwin_1bb262da570bff653a8d8be9e785fb40.zip) in the folder dist. You can try it by running bin/slyft or (on Windows) bin\slyft.exe.

What's Gulp doing here? It fetches any missing Go dependencies, formats and vets the source, builds the binary, and runs the tests.

You can also call gulp build (same as the default task), gulp test (just run the tests), gulp watch (watch source files and trigger builds when they change) individually if you prefer.

If you find that gulp is not recognised (or you had to skip the first step because sudo is not available), you can call the local copy of gulp installed by npm directly:

$ node node_modules/gulp/bin/gulp.js

Ubuntu

There is a Debian naming conflict where the package manager installs nodejs but gulp expects the executable to be called node (that being the standard name of the Node.js binary).

To solve this problem, either install nodejs-legacy (which adds a symlink from /usr/bin/nodejs to /usr/bin/node) or call the local gulp instance directly using nodejs not node:

$ nodejs node_modules/gulp/bin/gulp.js

Docker

Use the Dockerfile to build the slyft client, use it from within a container, or copy it over to the host:

$ docker build -t slyft-cli .
(...)

$ docker run slyft-cli

Usage: Slyft [OPTIONS] COMMAND [arg...]
(...)

$ docker run -v $PWD:/tmpdist slyft-cli /bin/sh -c 'cp *.zip /tmpdist'
$ ls *.zip
slyft-0.1.1-debian-8.6_d80891d37976c3106093b391445cec40.zip

Windows

On Windows, be sure to build the program from Git Bash or a similar, unixy command prompt. gofmt in particular expects tools such as diff to be available.

When submitting pull requests, consider disabling Git's auto-detection for line endings:

git config --global core.autocrlf false

Avoiding crlf is important as gofmt standardises on Unix line endings.

If you're not on Windows, you may wish to cross-compile a Windows binary by entering:

$ gulp build-win32

License

(C) 2016,2017 Digital Incubation and Growth GmbH Licensed under the Apache License, Version 2.0 See LICENSE for details

slyft-cli's People

Contributors

aleicher avatar aschmidt75 avatar gerald1248 avatar sillyfellow avatar thingforward avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

slyft-cli's Issues

Client shows OK-conditions as errors

In a lot of places, log is showing messages as ERRO, but there are no errors.

ex:

$ slyft p delete                                                                            ✓  6528  14:27:28
Are you sure? [no]: no
ERRO 001 Good decision!

`asset delete` --all parameter misleading

$ slyft asset delete --all                                                               

  NUMBER |             NAME              | PROJECT NAME | URL
+--------+-------------------------------+--------------+-----+
       1 | blinkr-schema.json            | slyft-tut-1  |
(...)

Which one shall be deleted:

Either

  • remove --all parameter
  • or implement correctly (that is, deleting all the assets of a project)
    To be discussed.

I think we should remove the --all parameter, thats easier.

parse error messages from API and pretty print

eg. creating a second project with the same name for the same user is not allowed
The API returns forbidden.

however, the CLI does not show this error message, hence no feedback to the user is given.

it will be nice to show the error to the user

Have clear(er) exit codes

we'd like to have correct exit codes for the client. As a first step, OK=0 and ERROR=1 would be ok. Do you see a generic method of sys.exit(1) whenever an error occured? Or do we need to go all over the code to find code blocks with error handling?

Add `resultDetails` to job status info

JobResults contains (in DB) a Key resultDetails, with a string containing a log message. Please include it in API and Client (for slyft project status).

`slyft project list` should give a compressed view

Right now, there is not much difference between the list and show subcommand, because both list
all details.

list should give a table with one line per Project (w/ Name, Details limited to 40chars max and Created At). Show should give all details as it is by now.

Handle long list of job status'es

After a while there will be a lot of jobs per project. I usually want to see the status of the latest job i ran.
What about:

  • When --all is given, show all jobs, asks user for job id; then show details for this job
  • When --all is NOT given, do not show all jobs table; show only latest job entry in table; then show details for this job.

Error message twice?

We're sorry, but your registration failed due to the following errors:
* Email already in use
ERRO 001 We're very sorry, but your registration failed.
  1. Removing the last line seems more sensible, but the first two lines may not be always there (in case the error is not an 'expected' error. (See line 256 of users.go : https://github.com/thingforward/slyft-cli/blob/master/users.go#L256 )

  2. Change the format of error messages in the non-debug mode.
    Remove the ERRO 001 -- leaving the message be there.

See line 20 of main.go: https://github.com/thingforward/slyft-cli/blob/master/main.go#L20

Show Error messages when user is not logged in

When not logged in, API calls are made, and they do not lead to proper error messages.
So, when .slyftrc oes not carry an access token, do not make API calls. Show message "Please log in first: slyft user login"

$ bin/slyft user logout                                                                         ✓  8006  13:00:37
Bye for now. Looking forward to seeing you soon...
 
$ bin/slyft project create                                                                      ✓  8007  13:02:12
Please provide project name: p2
Details to the project (optional): bla
$ bin/slyft asset delete                                                                        ✓  8008  13:02:18
Choosing the asset: failed.
Details: Failed with the wrong code: 401. (expected 200)

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.