Skip to content

gh project view with web flag does not open interactive mode #8721

Description

@harveysanders

I'm not sure if this is a bug or a not-yet-implemented feature.
gh project view with web flag does not open interactive mode

Describe the bug

gh project view with web flag does not open interactive mode, instead opens the browser with a project URL missing with zero values for organization and project number.

Steps to reproduce the behavior

  1. In any repo directory, run the following command:
$ gh project view --web

Opens the browser with the URL:

https://github.com/orgs//projects/0

Expected vs actual behavior

Based on how the project command works without the --web flag, I would expect the command to start interactive mode and prompt me to select a project. Instead, it opens the browser with a URL that is missing the organization and project number.

$ gh project view
? Which owner would you like to use?  [Use arrows to move, type to filter]
> harveysanders
# ... rest of available organizations

Many of the other commands start interactive mode when the --web and no other arguments are provided. For example, gh run view --web starts interactive mode and prompts me to select a run.
Ex. running the view command in this cli/cli repo:

gh run view --web
? Select a workflow run  [Use arrows to move, type to filter]
> - Unexpecte comparison operator error when using templates with graphql query, Discussion Triage (trunk) 50m38s ago
  ✓ Unexpecte comparison operator error when using templates with graphql query, Issue Automation (trunk) 50m46s ago
  - Unexpecte comparison operator error when using templates with graphql query, Discussion Triage (trunk) 50m46s ago

Given this behavior on some of the other commands, I expected the same behavior for project.

Anyway, thanks for building this great tool. I use it nearly every day. I'd be happy to submit a PR in time if this is not a high-priority issue.

Activity

  1. harveysanders commented on Feb 19, 2024

    @harveysanders
    ContributorAuthor

    forgot the version

    gh --version
    gh version 2.44.1 (2024-02-16)
    https://github.com/cli/cli/releases/tag/v2.44.1
    
  2. williammartin commented on Feb 20, 2024

    @williammartin
    Member

    Hey @harveysanders thanks for the detailed bug report, very useful. I can verify this happens to me.

    Image

    I can see it being borderline between a missing feature (since the documented example does work) and a bug. In either case I think it's reasonable to expect this to work.

    I'm going to label this as help wanted and would love to receive a PR from you. I haven't confirmed but seems like we'd need to move this conditional below the NewOwner and NewProject which do the prompting, and to add some tests that ensure this works in TTY mode and respond to the prompts correctly:

    if config.opts.web {
    url, err := buildURL(config)
    if err != nil {
    return err
    }
    if err := config.URLOpener(url); err != nil {
    return err
    }
    return nil
    }

  3. added
    priority-3Affects a small number of users or is largely cosmetic
    gh-projectrelating to the gh project command
    enhancementa request to improve CLI
    and removed
    bugSomething isn't working
    priority-3Affects a small number of users or is largely cosmetic
    on Feb 20, 2024
  4. harveysanders commented on Feb 20, 2024

    @harveysanders
    ContributorAuthor

    @williammartin sounds good! Thanks for the pointers. I'm not sure when I'll be able to get to it, but I'd be happy to put something together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-projectrelating to the gh project commandhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions