Urgent.News

What's breaking now, across thousands of outlets.

Editions

Tech

Tab completion, without writing a completion script

The first post derived a whole command line interface from a client class, and the second turned it into a command that runs from any directory. Both left the same gap in place: the tool knows a great deal that its user does not. order_by is one of four strings. distance_unit is one of two. level is one of five. The client says so in its type hints, and jsonargparse enforces every one of them, to…

The story discusses an innovative solution for providing tab completion functionality in command line tools without the need to write a completion script. Traditional methods require writing scripts in the shell's own language, which can be tedious and prone to going out of date. The article highlights how the jsonargparse library, when paired with a Python package called shtab, can generate the required completion script automatically.

This integration allows the parser to utilize the choices, paths, and types defined in the client's signatures, eliminating the need for manual intervention. The complete tab completion feature is optional and can be enabled via a module-level call or an environment variable. It extends to subcommands and offers context-aware options and choices, as well as detailed type information.

The process is seamless and does not require modifications to existing code or additional dependencies, making it a practical solution for developers looking to enhance their tools with intelligent tab completion.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

NCC Has Transformed Telecom Industry, Says Adedigba

Oghenevwede Ohworiole in Abuja The immediate past Director, Research and Development, of the Nigerian Communications Commission (NCC), Ismail Adedigba, has disclosed that in his over three decades of…

  • Ismail Adedigba served 32 years at NCC in various roles
  • Highlighted telecom industry transformation during tenure
  • Urged integrity and public interest in public service

SKILL.md is not a compiler

If you use Cursor long enough, you will watch it ignore a rule you wrote down. You add a SKILL.md. You tell it "no explicit any". You maybe add a hook. It agrees. Then it ships id: any anyway.

3 Ways to Manage Files in CloudShell

So you've probably had to open CloudShell from time to time to poke at something quickly. Say I wanted to test pulling down an artifact from a private CodeArtifact registry.

More from Thursday 20 August →