Skip to content

Commit

Permalink
feat: re-add built specs and update gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
cstrnt committed Apr 15, 2021
1 parent 2ba8fee commit 3879070
Show file tree
Hide file tree
Showing 75 changed files with 42,523 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ build
npm-debug.log
.env
.idea/
.vscode

# They will be build on merge
specs
.vscode
232 changes: 232 additions & 0 deletions specs/brew.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
var generators = {
servicesgenerators: {
script: "brew services list | sed -e 's/ .*//' | tail -n +2",
postProcess: function (out) {
return out
.split("\n")
.filter(function (line) { return !line.includes("unbound"); })
.map(function (line) { return ({
name: line,
type: "option",
}); });
},
},
};
var completionSpec = {
name: "brew",
description: "Package manager for macOS",
subcommands: [
{ name: "list", description: "List all installed formulae" },
{
name: "leaves",
description: "List installed formulae that are not dependencies of another installed formula",
},
{
name: "doctor",
description: "Check your system for potential problems",
},
{
name: "info",
description: "Display brief statistics for your Homebrew installation",
},
{
name: "update",
description: "Fetch the newest version of Homebrew and all formulae",
},
{ name: "upgrade", description: "Upgrade outdated casks and outdated" },
{
name: "search",
description: "Perform a substring search of cask tokens and formula names",
},
{
name: "config",
description: "Show Homebrew and system configuration info",
},
{
name: "install",
description: "Install <formula>",
insertValue: "install ",
args: {
variadic: true,
name: "formula",
description: "Formula or cask to install",
generators: {
script: "HBPATH=$(brew --repository); ls -1 $HBPATH/Library/Taps/homebrew/homebrew-core/Formula $HBPATH/Library/Taps/homebrew/homebrew-cask/Casks",
postProcess: function (out) {
return out.split("\n").map(function (formula) {
return {
name: formula.replace(".rb", ""),
description: "formula",
icon: "🍺",
priority: (formula[0] >= "0" && formula[0] <= "9") || formula[0] == "/"
? 0
: 51,
};
});
},
},
},
},
{
name: "uninstall",
description: "Uninstall <formula>",
args: {
variadic: true,
name: "formula",
generators: {
script: "brew list -1 --formulae",
postProcess: function (out) {
return out.split("\n").map(function (formula) {
return {
name: formula,
icon: "🍺",
description: "Installed formula",
};
});
},
},
},
},
{
name: "cask",
insertValue: "cask ",
description: "Homebrew Cask provides a friendly CLI workflow for the administration of macOS applications distributed as binaries.",
subcommands: [
{
name: "install",
insertValue: "install ",
description: "Installs the given cask",
args: {
name: "cask",
description: "Cask to install",
},
},
{
name: "uninstall",
insertValue: "uninstall ",
description: "Uninstalls the given cask",
args: {
variadic: true,
generators: {
script: "brew list -1 --cask",
postProcess: function (out) {
return out.split("\n").map(function (formula) {
return {
name: formula,
icon: "🍺",
description: "Installed formula",
};
});
},
},
},
},
],
},
{
name: "services",
description: "Manage background services with macOS' launchctl(1) daemon manager.",
options: [
{
name: ["-d", "--debug"],
description: "Display any debugging information.",
},
{
name: ["-q", "--quiet"],
description: "Suppress any warnings.",
},
{
name: ["-v", "--verbose"],
description: "Make some output more verbose.",
},
{
name: ["-h", "--help"],
description: "Get help with services command",
},
],
subcommands: [
{
name: "cleanup",
insertValue: "cleanup",
description: "Remove all unused services.",
},
{
name: "list",
insertValue: "list",
description: "List all services.",
},
{
name: "run",
insertValue: "run ",
description: "Run the service formula without registering to launch at login (or boot).",
options: [
{
name: "--all",
insertValue: "--all",
description: "Start all services",
},
],
args: {
variadic: true,
generators: generators.servicesGenerator,
},
},
{
name: "start",
insertValue: "start ",
description: "Start the service formula immediately and register it to launch at login",
options: [
{
name: "--all",
insertValue: "--all",
description: "Start all services",
},
],
args: {
variadic: true,
generators: generators.servicesGenerator,
},
},
{
name: "stop",
insertValue: "stop ",
description: "Stop the service formula immediately and unregister it from launching at",
options: [
{
name: "--all",
insertValue: "--all",
description: "Start all services",
},
],
args: {
variadic: true,
generators: generators.servicesGenerator,
},
},
{
name: "restart",
insertValue: "restart ",
description: "Stop (if necessary) and start the service formula immediately and register it to launch at login (or boot).",
options: [
{
name: "--all",
insertValue: "--all",
description: "Start all services",
},
],
args: {
variadic: true,
generators: generators.servicesGenerator,
},
},
],
},
],
options: [
{
name: ["--version"],
description: "The current Homebrew version",
},
],
};

Loading

0 comments on commit 3879070

Please sign in to comment.