Skip to content

Viewing and search source code in CLI #3978

Description

@ShukantPal

Describe the feature or problem you’d like to solve

When working on a project, I sometimes want to how a library works to pinpoint the cause of a bug. It's a lot of friction to go to the repository on GitHub, search for the file, and then go to the line/function I'm looking for.

Proposed solution

A command like:

gh view ShukantPal/pixi-essentials packages/svg/src/SVGTextNode.ts

This could open up a readonly vim editor for that file.

If I don't know the exact name of a file, I should be able to search:

gh view ShukantPal/pixi-essentials --search SVGTextNode.ts

This could open up an interactive list of search results. I should be able to choose on by arrows keys and then Enter.

Activity

  1. added
    extension-ideaAn idea that could make a good GitHub CLI extension
    and removed
    needs-designAn engineering task needs design to proceed
    on Mar 31, 2022
  2. mislav commented on May 16, 2022

    @mislav
    Contributor

    Hi, thank you for the feature requests!

    Right now we're not going to commit to building tools for exploring source code into gh, but nothing is stopping anyone from making an extension that does. For example, gh view could be implemented to similar to the gh cp extension: https://github.com/mislav/gh-cp/blob/main/gh-cp

    We might add code search functionality in the future, but for now we're waiting on some GitHub platform search features to be developed first before we start working on corresponding CLI functionality. In the meantime, I'm closing this to clean up our backlog.

  3. tekumara commented on Jun 16, 2023

    @tekumara

    See #7376

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 CLIextension-ideaAn idea that could make a good GitHub CLI extension

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions