pickfire / fish-manpage-completions

WIP Port of fish-shell's Python manpage completion script to Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fish-manpage-completions

Build Status

Port! Not Starboard! From Python to Rust!

We're planning to do an initial naïve port from the Python source with the same function names, class (i.e., struct/enum in Rust) names, etc.

To contribute, add a comment to this issue, claiming a function. When you have it ported in your local or forked branch, submit a PR that includes a link to your comment.

For in-depth discussion of a particularly hairy function, open a dedicated issue or pipe up on the RustDC Zulip chat.

Getting Started

Cargo and rustc are a prerequisite, to install check https://rustup.rs/.

To build and run tests.

cargo test

To run the command. (Not working as of now)

cargo run

Examples

The following initial snippet of the tr program's manpage

.Dd July 23, 2004
.Dt TR 1
.Os
.Sh NAME
.Nm tr
.Nd translate characters
.Sh SYNOPSIS
.Nm
.Op Fl Ccsu
.Ar string1 string2
.Nm
.Op Fl Ccu
.Fl d
.Ar string1
.Nm
.Op Fl Ccu
.Fl s
.Ar string1
.Nm
.Op Fl Ccu
.Fl ds
.Ar string1 string2
.Sh DESCRIPTION
The
.Nm
utility copies the standard input to the standard output with substitution
or deletion of selected characters.
.Pp
The following options are available:
.Bl -tag -width Ds
.It Fl C
Complement the set of characters in
.Ar string1 ,
that is
.Dq Fl C Li ab
includes every character except for
.Ql a
and
.Ql b .
.It Fl c
Same as
.Fl C
but complement the set of values in
.Ar string1 .
.It Fl d
Delete characters in
.Ar string1
from the input.
.It Fl s
Squeeze multiple occurrences of the characters listed in the last
operand (either
.Ar string1
or
.Ar string2 )
in the input into a single instance of the character.
This occurs after all deletion and translation is completed.
.It Fl u
Guarantee that any output is unbuffered.

is parsed, and the description extracted to form part of the simple completion available.

Piped through

cat PATH/TO/TR.1 | cargo run -- --stdout

will eventually (when we get enough functionality ported) yield the following

# Autogenerated from man page STDIN
complete -c tr -s u --description 'Guarantee that any output is unbuffered.'

Passing this as source into fish will cause this description to be displayed when fish shows tr as an auto-completeable command.

About

WIP Port of fish-shell's Python manpage completion script to Rust


Languages

Language:Rust 51.8%Language:Roff 40.6%Language:Shell 7.6%