mirror of
https://onedev.site.tesses.net/crosslang/crosslangextras
synced 2026-02-08 17:15:45 +00:00
Add json listing for crosslang new
This commit is contained in:
@@ -16,4 +16,26 @@ func Tesses.CrossLang.GetNameAndDescription(name)
|
||||
name = TypeOf(j.toolname) == "String" ? j.toolname : name;
|
||||
|
||||
return $"{name}: {description}";
|
||||
}
|
||||
func Tesses.CrossLang.GetNameAndDescriptionJson(name)
|
||||
{
|
||||
var strm = FS.Local.OpenFile(name,"rb");
|
||||
var file = VM.LoadExecutable(strm);
|
||||
|
||||
strm.Close();
|
||||
|
||||
var name = file.Name;
|
||||
|
||||
var j = Json.Decode(file.Info);
|
||||
var description = TypeOf(j.description) == "String" ? j.description : "";
|
||||
|
||||
if(j.type == "template")
|
||||
name = TypeOf(j.template_name) == "String" ? j.template_name : name;
|
||||
else if(j.type == "tool")
|
||||
name = TypeOf(j.toolname) == "String" ? j.toolname : name;
|
||||
|
||||
return {
|
||||
name,
|
||||
description
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user