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

[FEAT]: Copilot output as JSON format #70

Open
moutonjeremy opened this issue Apr 30, 2024 · 0 comments
Open

[FEAT]: Copilot output as JSON format #70

moutonjeremy opened this issue Apr 30, 2024 · 0 comments
Labels
enhancement New feature or request needs-triage needs to be reviewed

Comments

@moutonjeremy
Copy link

Describe the need

I would like to be able to choose the output type of the copilot command (JSON for example) to be able to parse the result easily.
For example for a script to generate messages for git commit.

Relevant terminal output

$ gh copilot suggest "write a commit message for the x.go file following this modification $(git diff x.go)"
{ "suggest_result": "Update ttt function ....." }

With this, we can have a script like this:

#!/bin/bash

files=$(git status --porcelain | awk '{print $2}')

for file in $files; do
  echo "Analise file: $file"
  prompt="Write a commit message for this file $file with this modification $(git diff $file)"

  commit_message=$(gh copilot suggest --json $prompt | jq -r '.suggest_result')

  echo "Commit message for $file: $commit_message"
done
@moutonjeremy moutonjeremy added enhancement New feature or request needs-triage needs to be reviewed labels Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-triage needs to be reviewed
Projects
None yet
Development

No branches or pull requests

1 participant