FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cecli/cecli/tools/git_remote.py at main · cecli-dev/cecli · GitHub
cecli-dev
cecli
Repository navigation
Code
Issues
11
(11)
Pull requests
7
(7)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cecli
/
cecli
/
tools
/
git_remote.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (40 loc) · 1.31 KB
Breadcrumbs
cecli
/
cecli
/
tools
/
git_remote.py
Copy path
File metadata and controls
46 lines (40 loc) · 1.31 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from
cecli
.
repo
import
ANY_GIT_ERROR
from
cecli
.
tools
.
utils
.
base_tool
import
BaseTool
from
cecli
.
tools
.
utils
.
responses
import
ToolResponse
class
Tool
(
BaseTool
):
NORM_NAME
=
"gitremote"
SCHEMA
=
{
"type"
:
"function"
,
"function"
: {
"name"
:
"GitRemote"
,
"description"
:
"List remote repositories."
,
"parameters"
: {
"type"
:
"object"
,
"properties"
: {},
"required"
: [],
},
},
}
@
classmethod
def
execute
(
cls
,
coder
,
**
kwargs
):
"""
List remote repositories.
"""
response
=
ToolResponse
(
cls
.
NORM_NAME
)
if
not
coder
.
repo
:
response
.
append_result
(
"Not in a git repository."
)
return
response
try
:
remotes
=
coder
.
repo
.
repo
.
remotes
if
not
remotes
:
response
.
append_result
(
"No remotes configured."
)
return
response
result
=
[]
for
remote
in
remotes
:
result
.
append
(
f"
{
remote
.
name
}
\t
{
remote
.
url
}
"
)
response
.
append_result
(
"
\n
"
.
join
(
result
))
return
response
except
ANY_GIT_ERROR
as
e
:
coder
.
io
.
tool_error
(
f"Error running git remote:
{
e
}
"
)
response
.
append_error
(
str
(
e
))
return
response
Back
|
FazBrowse Home
|
New Git URL