Skip to content

Commit

Permalink
Merge pull request withfig#551 from withfig/mschrage/add-debug-subcom…
Browse files Browse the repository at this point in the history
…mand

[FIG] add `debug` subcommand
  • Loading branch information
mschrage committed Sep 7, 2021
2 parents 49ca788 + f4ff157 commit 6029227
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions dev/fig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,61 @@ const completionSpec: Fig.Spec = {
name: "set:path",
description: "Sync your $PATH variable with Fig",
},
{
name: "debug",
// workaround to avoid showing immediate execute arrow from appearing when 'debug' is entered
insertValue: "debug {cursor}",
description: "Utilities that are helpful when things break",
subcommands: [
{
name: "terminal",
description:
"Print out terminal configuration and environment variables",
},
{
name: "app",
description: "Run app executable directly in terminal",
},
{
name: "sample",
description:
"Profile the Fig process to determine why it is hanging or locked",
},
{
name: "prefs",
description:
"Overview of user-defined preferences (config, settings.json, defaults)",
},
{
name: "logs",
description: "View categorized logs for all subsystems",
args: {
name: "subsystem",
isOptional: true,
isVariadic: true,
generators: {
script: "ls ~/.fig/logs",
trigger: (curr, prev) => {
// trigger on new token
return curr.length == 0 && prev.length > 0;
},
postProcess: (out, tokens) => {
const pivot = tokens.indexOf("logs");
const insertedLogFiles = tokens.slice(pivot);
return out
.split("\n")
.map((log) => {
return { name: log.replace(".log", "") };
})
.filter(
(suggestion) => !insertedLogFiles.includes(suggestion.name)
);
},
},
},
},
],
},
],

options: [
Expand Down

0 comments on commit 6029227

Please sign in to comment.