canonical / charmcraft

Collaborate, build and publish charmed operators for Kubernetes, Linux and Windows.
Apache License 2.0
65 stars 69 forks source link

Ineffective Output Filtering Using 'charmcraft help --all | grep revision' Command #1432

Open mateofloreza opened 9 months ago

mateofloreza commented 9 months ago

Bug Description

I attempted to use the command charmcraft help --all | grep revision to filter the output and specifically retrieve information related to revisions. However, the command did not function as expected. Instead of filtering the output to display only lines containing the term "revision," the entire printout was shown without any filtration.

Further investigation revealed that the issue stems from the output redirection. It appears that the information I intended to filter is being sent to the stderr rather than the stdout, causing the grep command to be ineffective in filtering the output.

To Reproduce

charmcraft help --all | grep revision

Environment

Ubuntu 22.04 LTS Charmcraft 2.5.2

charmcraft.yaml

-

Relevant log output

charmcraft help --all|grep revision
Usage:
    charmcraft [help] <command>

Summary:
    Charmcraft helps build, package and publish operators on Charmhub.

    Together with the Python Operator Framework, charmcraft simplifies
    operator development and collaboration.

    See https://charmhub.io/publishing for more information.

Global options:
            -h, --help:  Show this help message and exit
         -v, --verbose:  Show debug information and be more verbose
           -q, --quiet:  Only show warnings and errors, not progress
           --verbosity:  Set the verbosity level to 'quiet', 'brief',
                         'verbose', 'debug' or 'trace'
     -p, --project-dir:  Specify the project's directory (defaults to
                         current)

Commands can be classified as follows:

Basic:
               analyze:  Analyze a charm
                 clean:  Purge project artifacts
                  pack:  Build the charm or bundle
                  init:  Initialize a charm operator package tree and
                         files
               version:  Show charmcraft version

Charmhub:
                 login:  Login to Charmhub
                logout:  Logout from Charmhub and remove token
                whoami:  Show your Charmhub login status
              register:  Register a charm name in Charmhub
       register-bundle:  Register a bundle name in the Store
            unregister:  Unregister a name in the Store
                 names:  List your registered charm and bundle names in
                         Charmhub
                upload:  Upload a charm or bundle to Charmhub
             revisions:  List revisions for a charm or a bundle in
                         Charmhub
               release:  Release a charm or bundle revision in one or
                         more channels
        promote-bundle:  Promote a bundle to another channel in the
                         Store
                status:  Show channel and released revisions
                 close:  Close a channel for a charm or bundle
            create-lib:  Create a charm library
           publish-lib:  Publish one or more charm libraries
              list-lib:  List all libraries from a charm
             fetch-lib:  Fetch one or more charm libraries
             resources:  List the resources associated with a given
                         charm in Charmhub
       upload-resource:  Upload a resource to Charmhub
    resource-revisions:  List revisions for a resource associated to a
                         charm in Charmhub

Extensions:
       list-extensions:  List available extensions for all supported
                         bases
     expand-extensions:  Expand extensions in charmcraft.yaml

For more information about a specific command, run 'charmcraft help <command>'.
syncronize-issues-to-jira[bot] commented 1 week ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3356.

This message was autogenerated

lengau commented 1 week ago

I've logged this upstream in craft-cli. I'm not sure it's guaranteed to change, but we'll at least discuss it there: https://github.com/canonical/craft-cli/issues/273