Git Product home page Git Product logo

gwcli's Introduction

This has been merged into the Gravwell monorepo; use that instead. (PR#1142)

gwcli

A redesigned Gravwell client for the terminal, supporting both TUI-served interactivity and non-interactive script calls.

demo

Features

  • interactive and scriptable

  • full query editor (syntax highlighting NYI)

  • dynamic viewport for interacting with query results

  • mutliple query result download formats (CSV, JSON, raw)

  • shell-style navigation

  • tree command to view entire structure

  • command history

  • context-aware help for every command

  • automatic login via token (for subsequent logins)

  • completions for zsh, fish, bash, and powershell

  • limited tab completion in interactive mode

  • pluggable framework for easily adding new capabilities (complete with genericized boilerplate and generator functions)

Usage

./gwcli

The CLI can be used interactively or as a script tool.

Calling an action directly (ex: ./gwcli query tag=gravwell) will invoke the action and return the results.

Calling gwcli bare or from a menu (ex: ./gwcli tools macros) will start an interactive prompt at that directory (unless --script is given, in which case it will display help).

Attach -h to any command for full details on flags and commands.

Login

gwcli automatically logs in via token once one has been created. Use -u USER -p PASS the first call to generate the token automatically, then ./gwcli can be invoked without.

Troubleshooting

Client Not Ready For Login

Does your gravwell instance have a valid cert? If not, make sure you are using --insecure.

Design

gwcli is built on the fabulous BubbleTea and Cobra libraries. In the simplest of terms, gwcli is a cobra.Command tree with a bubbletea.Model crawling around it, interacting with Gravwell via their batteries-included client library.

See Contributing for a deep dive on the design philosophy and practical implementation.

Known Issues

  • Suggestions do not populate when navigation includes .. (upward) or ~// (from home/root)

    • This is just based on how bubbletea manages its suggestions. It operates off a list of strings, where each string is a complete command, returning closest-match. The suggestion engine is not intelligent enough to "walk" the current prompt (like the walk() subroutine is). We simple recur downward and supply these strings on every move. We do not supply suggestions with upward or rooted navigation because it would add a boatload more iterations and recusive logic when building the suggestions each hop. Relately, Bubble Tea does not handle .SetSuggestions coming in asyncronously, meaning each hop has to determine its suggestions immediately so keeping the lists down improves responsiveness.

gwcli's People

Contributors

rflandau avatar

Watchers

 avatar  avatar

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.