Testing cli tool with logging

This page summarizes the projects mentioned and recommended in the original post on dev.to

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • cobra

    A Commander for modern Go CLI interactions

  • and probably something else will be added in the future. The final kind of launch command would like to see such djob [options] - command. Command is the command (with arguments to run). -- should separate the arguments of the utility from the arguments of the program to run. There are several excellent solutions for working with command-line arguments, such as spf13/cobra or urfave/cli. But they’re good for building an interface out of a lot of commands, and for one (as in my example) they’re redundant. So I used the flag library. I have defined the following structure with arguments:

  • urfave/cli

    A simple, fast, and fun package for building command line apps in Go (by urfave)

  • and probably something else will be added in the future. The final kind of launch command would like to see such djob [options] - command. Command is the command (with arguments to run). -- should separate the arguments of the utility from the arguments of the program to run. There are several excellent solutions for working with command-line arguments, such as spf13/cobra or urfave/cli. But they’re good for building an interface out of a lot of commands, and for one (as in my example) they’re redundant. So I used the flag library. I have defined the following structure with arguments:

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • logrus

    Structured, pluggable logging for Go.

  • Before moving to testing I will talk about logging. Logging is another component that matters for testing implementation. In any case, it is required in almost any program, including the utility I describe. I used the library logrus, because it has the ability to intercept logs with hooks. And I used this feature to read logs during testing. At the same time, the code of the main function itself does not have to adapt to tests.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Golang - Writing CLI App in Golang with Cobra

    4 projects | dev.to | 26 Jul 2022
  • Heeded your recomendations about Nice - idiomatic and highly customizable CLI framework I'am crafting

    2 projects | /r/golang | 25 Sep 2021
  • Which packages do you recommend for building cli tools?

    10 projects | /r/golang | 17 Apr 2023
  • K3S Binary, How does that work?

    5 projects | /r/golang | 11 Apr 2023
  • Config for Golang Applications

    1 project | news.ycombinator.com | 24 Mar 2023