HamzaHassanain/polyman

Add Shell Auto-Completion Support

Aperta

#9 aperta il 24 nov 2025

 (0 commenti) (0 reazioni) (0 assegnatari)TypeScript (2 fork)auto 404
documentationenhancementgood first issuehelp wanted

Metriche repository

Star
 (33 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Description

Add shell auto-completion scripts for bash, zsh, and fish to improve developer experience and command discoverability. Users should be able to tab-complete commands, options, testset names, solution names, and other context-aware arguments.

Features

Command Completion:

polyman gen<TAB>  → polyman generate
polyman rem<TAB>  → polyman remote

Option Completion:

polyman generate --<TAB>
→ --all  --testset  --group  --index

polyman remote push --<TAB>
→ --all  --solutions  --checker  --validator  --tests

Context-Aware Completion:

# Complete testset names from Config.json
polyman generate -t <TAB>
→ tests  samples  pretests

# Complete solution names from Config.json
polyman run <TAB>
→ main  correct2  wa-solution  tle-solution

# Complete generator names
polyman generate -t tests -g <TAB>
→ samples  main  stress

Implementation Approach Using commander-completion

import completion from 'commander-completion';

program
  .command('completion')
  .description('Generate shell completion script')
  .action(() => {
    completion(program);
  });

Success Criteria

  • Completion works for all shells (bash, zsh, fish)
  • Static command/option completion works
  • Dynamic completion reads Config.json
  • Handles missing Config.json gracefully (fallback to static completion)
  • Installation instructions in README
  • Auto-suggest during npm install -g polyman-cli

Guida contributor