Created pip package
This commit is contained in:
22
copilot.py
22
copilot.py
@@ -4,6 +4,8 @@ import os
|
||||
import sys
|
||||
import time
|
||||
from os.path import expanduser
|
||||
import click
|
||||
|
||||
|
||||
# get a new github copilot token
|
||||
def get_token():
|
||||
@@ -105,14 +107,14 @@ def get_suggestion(prompt, token):
|
||||
|
||||
return "Command not found"
|
||||
|
||||
# cursor_position_char = int(sys.argv[1])
|
||||
@click.group()
|
||||
def main():
|
||||
pass
|
||||
|
||||
# Read the input prompt from stdin.
|
||||
# buffer = sys.stdin.read()
|
||||
buffer = 'change python version to 3.10'
|
||||
|
||||
# ---
|
||||
prompt_prefix = "!/bin/bash\n\n" + buffer + ":\n"
|
||||
|
||||
token = get_token()
|
||||
print(get_suggestion(prompt_prefix, token))
|
||||
@main.command()
|
||||
@click.argument('prompt', nargs=-1)
|
||||
def generate_suggestion(prompt):
|
||||
prompt = " ".join(prompt)
|
||||
prompt = "!/bin/bash\n\n" + prompt + ":\n"
|
||||
token = get_token()
|
||||
print(get_suggestion(prompt, token))
|
||||
Reference in New Issue
Block a user