Implement Your Own Tool Using HCL (Part 2)

weak pixel
Apr 14, 2022

This is the second part of my HCL series. You find the first part here (Part 1)

In the second post of my HCL series I want to extend our example with:

- Cobra Command-line
- Variables
- Functions

Cobra

Cobra is my favorite library to build command-line tools.

We start off with the example program from the first post (source).

As I write before I want to introduce you to the Cobra command-line tool. In order to use it we have to add a new import:

import (
“fmt”
“os”

“github.com/spf13/cobra”

// …

)

I would love to cross-post the full article to medium but it is too much work to convert all the code samples into Gists to be displayed here. If you like to continue the tutorial then please visit the post here

Apologies for the inconvenience.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response