Coding Challenge #45 - yq

Coding Challenge #45 - yq

This challenge is to build your own version of yq

The tool?yq?is a lightweight and flexible command-line YAML processor. It’s useful for processing YAML allowing us to quickly and effectively filter out the bits we want.

If You Enjoy Coding Challenges Here Are Five Ways You Can Help Support It

  1. Sign up for the newsletter on Substack. ??
  2. Refer a friend or colleague to the Substack newsletter. ??
  3. Sign up for a paid subscription - think of it as buying me a coffee ?? twice a month, except you also get 20% off any of my courses. ??
  4. Buy one of my courses that walk you through a Coding Challenge. ??
  5. If you work for a company that sells to software engineers, encourage them to sponsor the newsletter. ??

Coding Challenges News

I’m currently asking for feedback on what challenges to cover next. I’d appreciate your thoughts on?in this post. Thanks.

Purchasing Price Parity - I’m now offering PPP on my courses making them more accessible for everyone. Many thanks to all those who suggested it.

The Challenge - Building Your Own yq

The command line tool?yq?is like?jq?for YAML data - you can use it to and filter and transform YAML data, much like you would JSON dats with?jq. By the way, a past?Coding Challenge?was to?build your own jq if you fancy giving that a go.

Step Zero

Like?yq?itself we’re zero-indexed! In this step you’re going to set your environment up ready to begin developing our?yq?clone:?ccyq.

You can download some test YAML from my dropbox here.

Step 1

In this step your goal is to open the yaml file, read it and print it. You could parse it at this point or just read it and print it line by line.

The outcome should look something like this:

% ccyq quotes.yaml 
quotes:
  - id: 1
    quote: It is bad for a young man to sin; but it is worse for an old man to sin.
    author: Abu Bakr (R.A)
<snip>
  - id: 5
    quote: >-
      These Capitalists Generally Act Harmoniously And In Concert, To Fleece The People.
    author: Abraham Lincoln
        

N.B. I’ve trimmed the output to just show the first and last quote.

Continued...

You can find Step 2 and beyond on the Coding Challenges website as build your own yq.

Or if you'd rather get the whole challenge delivered to you inbox every week, you can subscribe on the Coding Challenges Substack.


2 Other Ways I Can Help You:

  1. I write another FREE newsletter Developing Skills that helps you level up the other skills you need to be a great software developer.
  2. I have some courses available: Build Your Own Redis Server (Python Edition) which guides you through solving the Redis Coding Challenge in Python. Build Your Own Shell (Go Edition) which guides you through solving the Shell Coding Challenge in Go.


Incredible lineup of challenges! ?? Each one is a unique opportunity to dive deep into coding fundamentals and beyond. Whether it's crafting your own yq or building a Redis server, there's something for every skill level. Hats off to you for fostering such an engaging learning community! Subscribing for sure to not miss out on the next challenge. Keep them coming!

Eric Roby

Software Engineer | Python Enthusiast | AI Nerd | Good Person to Know

1 年

Super unique idea! I love what you’re building.

ákos K?m?ves

Senior Software Engineer

1 年

These challenges helped me get my Go knowledge from 0 to where I'm confident with the syntax and can build small CLI applications without much effort. ?? recommended.

要查看或添加评论,请登录

John Crickett的更多文章

  • Coding Challenge #86 - Strace

    Coding Challenge #86 - Strace

    This challenge is to build your own version of Linux tool strace. It’s a useful tool to debug programs that you don’t…

    8 条评论
  • From The Challenges - Memcached Server

    From The Challenges - Memcached Server

    ?? ?? Happy Birthday Coding Challenges - Two Years Old! ?? ?? Coding Challenges is turning two this week! To celebrate…

    13 条评论
  • Coding Challenge #85 - Time Zone Converter

    Coding Challenge #85 - Time Zone Converter

    Coding Challenge #85 - Time Zone Converter This challenge is to build your own Time Zone Converter. That is a tool to…

    12 条评论
  • From The Challenges - IRC Client

    From The Challenges - IRC Client

    Welcome To Coding Challenges - From The Challenges! In this Coding Challenges “from the challenges” newsletter I’m…

    5 条评论
  • Coding Challenge #84 - Mandelbrot Set Explorer

    Coding Challenge #84 - Mandelbrot Set Explorer

    This challenge is to build your own Mandelbrot set explorer. The Mandelbrot set is a set of fractals that exhibit great…

    4 条评论
  • From The Challenges - Cat

    From The Challenges - Cat

    Welcome To Coding Challenges - From The Challenges! In this Coding Challenges “from the challenges” newsletter I’m…

    7 条评论
  • Coding Challenge #83 - Markdown Presentation Tool

    Coding Challenge #83 - Markdown Presentation Tool

    Coding Challenge #83 - Markdown Presentation Tool This challenge is to build your own version of Go’s Present or…

    3 条评论
  • From The Challenges - Shell

    From The Challenges - Shell

    Welcome To Coding Challenges - From The Challenges! In this Coding Challenges “from the challenges” newsletter I’m…

    3 条评论
  • Coding Challenge #82 - Markdown To PDF Editor

    Coding Challenge #82 - Markdown To PDF Editor

    Coding Challenge #82 - Markdown To PDF Editor This challenge is to build your own tool to convert markdown to PDF. It…

    14 条评论
  • From The Challenges - Diff

    From The Challenges - Diff

    Welcome To Coding Challenges - From The Challenges! In this Coding Challenges “from the challenges” newsletter I’m…

    7 条评论

社区洞察

其他会员也浏览了