simple-dmenu 0.1.0

A simple macro to call dmenu
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 255.63 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • callb4ck/simple-dmenu
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • callb4ck

Simple dmenu

A macro to call dmenu from rust

How to use

Standard

Requires every argument to implement .as_bytes(). Might also not need to pass any arguments at all

use simple_dmenu::dmenu;

// Example
let output = dmenu!("1", "2", "3");

Stringify

Same as standard but passes every argument to stringify!(). Again, might also not need to pass any arguments at all

use simple_dmenu::dmenu;

// Example
let output = dmenu!(stringify 1, 2, 3);

Iter

Accepts an iterator. Every value yielded by the iterator needs to implement .as_bytes()

use simple_dmenu::dmenu;

// Example
let mut a = vec!["1", "2", "3"];
a.push("4");

let output = dmenu!(iter a);

Prompt

Only shows a prompt with the specified prompt text

use simple_dmenu::dmenu;

// Example
let username = dmenu!(prompt "What's your name?");

Optional arguments

You can specify optional arguments to pass to dmenu by separating them with ; args

use simple_dmenu::dmenu;

// Example
let output = dmenu!(stringify 1, 2, 3; args "-p", "Choose a number", "-l", "3");

Arguments only

Empty call, only allows to specify arguments to pass on to dmenu

use simple_dmenu::dmenu;

// Example
let output = dmenu!(args
    "-p", "What's your name?",
    "--nb", "#FFFFFF",
    "--nf", "#000000"
);