Skip to content

Add tmt about, command showing things about tmt itself #3470

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

Merged
merged 9 commits into from
Apr 26, 2025
Merged

Conversation

happz
Copy link
Collaborator

@happz happz commented Jan 16, 2025

Pull Request Checklist

  • implement the feature
  • write the documentation
  • extend the test coverage
  • include a release note

@happz happz added the code | cli Changes related to the command line interface label Jan 16, 2025
@happz happz added this to the 1.43 milestone Jan 16, 2025
@psss
Copy link
Collaborator

psss commented Jan 17, 2025

This sounds like a very nice idea! Are there any limitations about the usage? I tried the new command within the venv but I get no output.

@happz
Copy link
Collaborator Author

happz commented Jan 17, 2025

This sounds like a very nice idea! Are there any limitations about the usage? I tried the new command within the venv but I get no output.

$ tmt about plugins --how rest
Export plugins for story

* `dict`
* `json`
* `template`
* `rst`
* `yaml`

----

Export plugins for plan

* `dict`
* `json`
* `template`
* `yaml`

----
...

$ tmt about plugins --how json | jq .
{
  "export.story": [
    "dict",
    "json",
    "template",
    "rst",
    "yaml"
  ],
  "export.plan": [
    "dict",
    "json",
    "template",
    "yaml"
  ],
  "export.test": [
    "dict",
    ...

The current limitation is, it's just listing plugins, nothing more. I hope to get it to share more info, maybe render plugin docs, specs docs, or explanation of various errors, just like rustc --explain does:

$ PAGER= rustc --explain E0277
You tried to use a type which doesn't implement some trait in a place which expected that trait.

Erroneous code example:

// here we declare the Foo trait with a bar method
trait Foo {
    fn bar(&self);
}

// we now declare a function which takes an object implementing the Foo trait
fn some_func<T: Foo>(foo: T) {
    foo.bar();
}

fn main() {
    // we now call the method with the i32 type, which doesn't implement
    // the Foo trait
    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied
}

In order to fix this error, verify that the type you're using does implement the trait. Example:

trait Foo {
    fn bar(&self);
}

// we implement the trait on the i32 type
impl Foo for i32 {
    fn bar(&self) {}
}

fn some_func<T: Foo>(foo: T) {
    foo.bar(); // we can now use this method since i32 implements the
               // Foo trait
}

fn main() {
    some_func(5i32); // ok!
}

...

@happz happz force-pushed the explain-plugin-list branch 4 times, most recently from 00f445b to c579ec7 Compare January 28, 2025 20:36
@happz happz added the ci | full test Pull request is ready for the full test execution label Jan 28, 2025
@happz happz force-pushed the explain-plugin-list branch from c579ec7 to 34de1cb Compare January 31, 2025 11:18
@happz happz requested a review from frantisekz as a code owner January 31, 2025 11:18
@happz happz force-pushed the explain-plugin-list branch from 34de1cb to d83731e Compare January 31, 2025 11:22
@happz happz changed the base branch from main to hints-everywhere January 31, 2025 11:23
@happz happz force-pushed the explain-plugin-list branch from d83731e to d55f9e5 Compare January 31, 2025 11:24
thrix
thrix previously requested changes Jan 31, 2025
Copy link
Collaborator

@thrix thrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately does not work well for me:

  • tmt about shows nothing, let's print maybe the help?

  • tracebacks with plaing tmt about plugins ls

$ tmt about plugins ls                                                                                                                                                                                    
Unhandled ReST node '<title_reference>dict</title_reference>'.                                                                                                                                                  (shell returned 2)

@happz happz force-pushed the hints-everywhere branch 4 times, most recently from a010e3b to 176d9dd Compare February 3, 2025 19:51
@happz happz force-pushed the explain-plugin-list branch from d55f9e5 to bef582f Compare February 4, 2025 13:51
@happz
Copy link
Collaborator Author

happz commented Feb 4, 2025

Unfortunately does not work well for me:

  • tmt about shows nothing, let's print maybe the help?
  • tracebacks with plaing tmt about plugins ls
$ tmt about plugins ls                                                                                                                                                                                    
Unhandled ReST node '<title_reference>dict</title_reference>'.                                                                                                                                                  (shell returned 2)

Both issues should be fixed now.

@happz happz force-pushed the hints-everywhere branch 3 times, most recently from aca20a7 to a08c302 Compare February 12, 2025 11:56
@happz
Copy link
Collaborator Author

happz commented Apr 14, 2025

/packit build

@happz happz force-pushed the explain-plugin-list branch from bb25826 to aabde42 Compare April 14, 2025 11:11
@happz happz added the status | ready for merge The only missing piece is to do the rebase the current 'main' and let the CI finish. label Apr 16, 2025
@happz happz moved this from review to merge in planning Apr 16, 2025
@happz happz force-pushed the explain-plugin-list branch from aabde42 to 0719cb2 Compare April 16, 2025 19:44
@happz happz force-pushed the explain-plugin-list branch from a8dbfec to 5bc66ea Compare April 17, 2025 08:26
Copy link
Collaborator

@psss psss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we include at least a short release note? The command is very simple, true, but still, it's a new tmt subcommand and users deserve to learn about it, hm?

@happz
Copy link
Collaborator Author

happz commented Apr 17, 2025

Could we include at least a short release note? The command is very simple, true, but still, it's a new tmt subcommand and users deserve to learn about it, hm?

True, but I hesitate. tmt about is indeed new, but only knows how to list discovered plugins, which is not that much. I hope to add more functionality users more visible and helpful for users, maybe a release note would be better then?

@psss
Copy link
Collaborator

psss commented Apr 17, 2025

True, but I hesitate. tmt about is indeed new, but only knows how to list discovered plugins, which is not that much. I hope to add more functionality users more visible and helpful for users, maybe a release note would be better then?

Ok, understood. Let's make it more visible later.

@thrix thrix modified the milestones: 1.47, 1.48 Apr 23, 2025
@happz happz force-pushed the explain-plugin-list branch from 484329b to 4b455cd Compare April 25, 2025 23:10
@happz happz enabled auto-merge (squash) April 25, 2025 23:11
@happz happz dismissed thrix’s stale review April 25, 2025 23:12

Outdated, and resolved.

@happz happz merged commit f55ec36 into main Apr 26, 2025
23 checks passed
@happz happz deleted the explain-plugin-list branch April 26, 2025 10:24
@github-project-automation github-project-automation bot moved this from merge to done in planning Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci | full test Pull request is ready for the full test execution code | cli Changes related to the command line interface status | ready for merge The only missing piece is to do the rebase the current 'main' and let the CI finish.
Projects
Status: done
Development

Successfully merging this pull request may close these issues.

7 participants