Candy is a CLI tool that offers a fundamental set of commands to streamline your DevOps processes.

  • By Pradumna Saraf
  • Last update: Aug 14, 2023
  • Comments: 12

Candy

Candy CLI logo

Releases Go Reference

Candy is a CLI tool that provides a basic set of commands to perform tedious tasks such as converting YAML to JSON or JSON to YAML directly from your terminal. It's built with Go, Cobra, Viper, etc.

To install the Candy CLI, use the command go install github.com/Pradumnasaraf/candy@latest. Go will automatically install it in your $GOPATH/bin directory, which should be in your $PATH.

Once installed, you can use the candy CLI command. To confirm installation, type candy at the command line.

Note If you are getting an error like command not found: candy, then you need to add $GOPATH/bin to your $PATH environment variable. For that you can refer to this.

📚 Documentation

Check out detailed documentation for getting started and using Candy CLI here.

⭐️ Features

  • Convert JSON file to YAML
  • Convert YAML file to JSON
  • Convert Key-Value to JSON
  • Generate Dockerfile for different languages/framework
  • Generate Kubernetes manifests for different objects
  • Encode and Decode a string to base64
  • More coming soon...

📝 Usage

Usage:
  candy [command] [flags]
  candy [command]

Available Commands:
  JTY         Converts a JSON into YAML.
  KVTJ        Converts Key-Value (text) to JSON.
  YTJ         Converts a YAML into JSON.
  docker      Docker related commands. Like generating a Dockerfile for a language.
  encode      It encodes and decodes a string to base64 and vice versa.
  k8s         Kubernetes related commands. Like generating manifest files for kubernetes objects.

For detailed usage of each command, visit here

Eg candy JTY --file test.json with convert JSON into YAML and create a output.yaml in your current directory.

Eg candy docker dockerfile --lang go to generate a Dockerfile template for go.

eg candy k8s manifest --obj deployment to generate a deployment.yaml file with deployment template.

📜 License

This project is licensed under the Apache-2.0 license - see the LICENSE file for details.

🛡 Security

If you discover a security vulnerability within this project, please check the SECURITY for more information.

Download

candy.zip

Comments(12)

  • 1

    Adding the version command

    🛠️ Fixes Issue

    Closes #13

    👨‍💻 Changes proposed

    Added a new file for version.yml and version.go.

    ✔️ Check List (Check all the applicable boxes)

    • [x] My code follows the code style of this project.
    • [x] This PR does not contain plagiarized content.
    • [x] The title of my pull request is a short description of the requested changes.
  • 2

    docs: use the latest CoC version

    👨‍💻 Changes proposed

    • Use the latest code of conduct version.

    ✔️ Check List (Check all the applicable boxes)

    • [x] My code follows the code style of this project.
    • [x] This PR does not contain plagiarized content.
    • [x] The title of my pull request is a short description of the requested changes.

    📄 Note to reviewers

    None.

  • 3

    [FEATURE] Feature to convert Key-Value pair to JSON

    Description

    Please add a feature to convert the Key-Value pair to JSON. An online tool is available for this, but it's not safe to use for confidential data.

    Screenshots

    No response

  • 4

    Feedback

    Description

    1. I just jumped to this repo as it's in Open Source projects from Pradumna's profile but here no where is written that it's Open Source.
    2. Need to add getting started guides so that if anyone wants to contribute to the projects then, they are refer the guide and easily contribute to the project.
    3. Readme need to me more engaging so that new user doesn't feel overwhelming to contribute to the repo.

    Screenshots

    No response

  • 5

    [DOCS] Update links to match new domain

    Description

    There are a few links that are using the old website link (https://pradumnasaraf.github.io/candy). However, the new link (https://pradumnasaraf.dev/candy) should be used instead.

    The README.md file has two instances of these links, which should be updated. Those can be found at line 22 and line 47.

    Let us know if you need any help updating this! 🙂

    Screenshots

    No response

  • 6

    [BUG] fix "=" case in KVTJ command env file

    Description

    If the file we pass inKVTJcommand contains = in the value it works not convert that, but it will not break the process. eg:

    GH_TOKEN==dfdfdfd
    
  • 7

    feat: Add a sub command in docker - `container`

    Add a subcommand in docker - "container" to stop, delete and rename it.

    eg:

    candy docker container stop
    candy docker container stop --all   
    candy docker container rename   
    
    
  • 8

    feat: Add Unit tests

    🛠️ Fixes Issue

    Closes #22

    👨‍💻 Task List

    • [x] Add test for root command
    • [x] Add test for sub-command
      • [x] Encode
      • [x] Decode
      • [x] YTJ
      • [x] JTY
      • [x] KVTJ
      • [x] docker
      • [x] k8s
      • [x] version
    • [x] Add GitHub workflow to automate the testing
  • 9

    fix: error handeling for kvtj command

    🛠️ Fixes Issue

    Closes #15

    👨‍💻 Changes proposed

    KVTJ command will now be able to handle empty lines and the key value without an =. Additionally, if the line is commented on # or // it will skip it

  • 10

    docs: fix typos in README

    👨‍💻 Changes proposed

    Hey Pradumna, I was just checking out your repo and noticed a few small typos in the readme file. This PR fixes them :)

    ✔️ Check List (Check all the applicable boxes)

    • [x] My code follows the code style of this project.
    • [x] This PR does not contain plagiarized content.
    • [x] The title of my pull request is a short description of the requested changes.

    📄 Note to reviewers

    📷 Screenshots

  • 11

    chore: disable blank issues

    👨‍💻 Changes proposed

    • Disable blank issues.

    ✔️ Check List (Check all the applicable boxes)

    • [x] My code follows the code style of this project.
    • [x] This PR does not contain plagiarized content.
    • [x] The title of my pull request is a short description of the requested changes.

    📄 Note to reviewers

    None.

  • 12

    [FEATURE] Consider support for TOML

    Description

    TOML is another format Candy could support. With Rust using it for every package it could be useful for those who don't want to learn how to use it.

    Screenshots

    No response