console-rs / console-rs/console

style! or console::format! macro

Open
#114 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.2k
Forks
144
Avg merge
8h 24m
Merged PRs (30d)
4

Description

I might be nice to have a fancy style! (or console::format!) macro to replace format! usage.

Example

This is how I could make a progress string now.

let progress = 100.0 / 3.0;
let elapsed = Duration::from_secs(66);

let progress = format!(
    "{:.1}% in {:?}",
    style(progress).bold(),
    style(elapsed).green().italic(),
);

The macro could work something like:

let progress = 100.0 / 3.0;
let elapsed = Duration::from_secs(66);

let progress = style!("{:.1.bold}% {:?.green.italic}", progress, elapsed);

Or with argument capture:

let progress = 100.0 / 3.0;
let elapsed = Duration::from_secs(66);

let progress = console::format!("{progress:.1.bold}% {elapsed:?.green.italic}");

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, entry points, or tests. Start by reviewing the existing Rust style(...) and format!(...) usage, then define how the proposed style! or console::format! syntax should apply formatting and styles; done means the examples work with the intended macro behavior and have coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.