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

Add a spec for "Snippets" #17329

Merged
merged 13 commits into from
Jun 22, 2024
2 changes: 2 additions & 0 deletions .github/actions/spelling/allow/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ postmodern
Powerline
powerline
ptys
pwn
pwshw
quickfix
qof
Expand Down Expand Up @@ -137,6 +138,7 @@ We'd
westus
wildcards
workarounds
wtconfig
XBox
YBox
yeru
Expand Down
648 changes: 648 additions & 0 deletions doc/specs/#1595 - Suggestions UI/Snippets.md

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions doc/specs/#1595 - Suggestions UI/dump-workflows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import yaml
import json
import sys
import os

def parse_yaml_files(tool, directory):
json_data = {}
json_data["name"] = f"{tool}..."
json_data["commands"] = []

for filename in os.listdir(directory):
if filename.endswith(".yaml") or filename.endswith(".yml"):
file_path = os.path.join(directory, filename)
with open(file_path, 'r', encoding="utf-8") as file:
try:
yaml_data = yaml.safe_load(file)
new_obj = {}
command = {}
command["input"] = yaml_data["command"]
command["action"] ="sendInput"

new_obj["command"]=command
new_obj["name"] = yaml_data["name"]

new_obj["description"] = yaml_data["description"] if "description" in yaml_data else ""
json_data["commands"].append(new_obj)
except yaml.YAMLError as e:
print(f"Error parsing {filename}: {e}")
sys.exit(-1)
return json_data

def main(directory) -> int:
json_data = {}
json_data["actions"] = []

for tool_dir in os.listdir(directory):
# print(tool_dir)
json_data["actions"].append(parse_yaml_files(tool_dir, os.path.join(directory, tool_dir)))
print(json.dumps(json_data, indent=4))
return 0

if __name__ == '__main__':
# Write this output to something like
# "%localappdata%\Microsoft\Windows Terminal\Fragments\warp-workflows\actions.json"
sys.exit(main("d:\\dev\\public\\workflows\\specs"))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading