Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projects tab similar to taskwarrior summary #538

Open
aniketgm opened this issue Feb 12, 2024 · 5 comments
Open

Projects tab similar to taskwarrior summary #538

aniketgm opened this issue Feb 12, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@aniketgm
Copy link

aniketgm commented Feb 12, 2024

This is more of UI request

Description

When I run taskwarrior, this is what I get (screenshot below, tw is my alias for task command)

WindowsTerminal_3YlkxB911D

And this is what I see the Projects tab in taskwarrior-tui.

WindowsTerminal_RYebtAhrAF

Expectation

Is there a way to get the Projects tab similar to what taskwarrior is displaying (filled rectangular boxes instead of '=') ?

Version

wezterm-gui_RLinPDZZ5Y
@aniketgm aniketgm added the enhancement New feature or request label Feb 12, 2024
@kdheepak
Copy link
Owner

Currently taskwarrior-tui just runs task summary as a process and puts that output into the view:

let output = Command::new("task")
.arg("summary")
.output()
.context("Unable to run `task summary`")
.unwrap();

I'm surprised it is showing anything different in this case.

@aniketgm
Copy link
Author

aniketgm commented Feb 13, 2024

Currently taskwarrior-tui just runs task summary as a process and puts that output into the view:

I'm not aware much about Rust. From what I can understand, the .output() might be doing something internally that is converting the filled rectangles to '='. If not the unwrap() function. Correct me if I'm wrong.

@kdheepak
Copy link
Owner

.output() just reads the stdout of running task summary, and .unwrap() is a rust way of converting a result into a value (think try: parse_to_string(cmd.output()); else: raise Exception("Raise an error and stop the application") in Python).

I think either

  1. taskwarrior's task is behaving differently when called in the context of Command::new(task).arg(summary), or
  2. there's some terminal setting that's causing task summary to behave differently in taskwarrior-tui

I'll try to replicate the issue on my end, and that will help give me some idea as to what is going on.

@flugsio
Copy link

flugsio commented Feb 28, 2024

This is in taskwarrior, it outputs = and no colors when stdout is not to a terminal, for example task summary | cat, it's common to provide different features for TTY/non-TTY

It can be overriden like this task rc._forcecolor=1 summary https://github.com/GothenburgBitFactory/taskwarrior/blob/8dd29e0a8a2640eecc9b5510a9d252540b2fd146/src/Context.cpp#L268

It could also be faked, here's a random crate, but that could cause issues. For example if the process expects the user to give some input, it could for example provide an pagination interface and never terminate.

edit:
here's what it looks like when putting _forcecolor=1 in ~/.taskrc. The ansi color escape codes would need to be parsed
2024-02-28_11-07

@aniketgm
Copy link
Author

aniketgm commented Jul 8, 2024

here's what it looks like when putting _forcecolor=1 in ~/.taskrc. The ansi color escape codes would need to be parsed

Hey, no pressure, do we have any changes for this ? As mentioned by @flugsio , the ansi codes would need to be parsed.
@kdheepak, I was looking at ansi parser yesterday and found this ansi-parser crate. Might help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants