Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved gql-cli script #148

Merged

Conversation

leszekhanusz
Copy link
Collaborator

@leszekhanusz leszekhanusz commented Oct 11, 2020

Breaking changes:

  • Now printing result as json
  • Now working with multi-lines queries, using Ctrl-D (EOF) to execute queries
  • Using --variables instead of --params

Improvements of the gql-cli script:

  • add --version flag
  • add --verbose and --debug arguments
  • add --operation-name argument
  • add --headers argument
  • examples added in --help
  • moved most of the script content in the gql module
  • added sphinx docs, usage automagically set using sphinx-argparse
  • added tests for the gql-cli script

@codecov-io
Copy link

codecov-io commented Oct 11, 2020

Codecov Report

Merging #148 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master      #148    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           13        14     +1     
  Lines          806       906   +100     
==========================================
+ Hits           806       906   +100     
Impacted Files Coverage Δ
gql/cli.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dad37ac...db00018. Read the comment docs.

@leszekhanusz
Copy link
Collaborator Author

Still need to add tests for the script code coverage

Better docs

Now returning results as json
@leszekhanusz leszekhanusz added the type: feature A new feature label Oct 13, 2020
Copy link
Contributor

@KingDarBoja KingDarBoja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides getting no output while testing on my conda environment, I see the other arguments working (like help, debug, verbose). Need some time to checkout what's the correct usage on my case but overall looks great!

EDIT Finally:

$ echo query { continent(code:"AF") { name } } | python scripts/gql-cli https://countries.trevorblades.com
{"continent": {"name": "Africa"}}
// Some error related to asyncio issues with windows

🚀

@leszekhanusz leszekhanusz merged commit f191bba into graphql-python:master Oct 14, 2020
@leszekhanusz leszekhanusz deleted the feature_improved_gql_cli branch October 24, 2020 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants