Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ place it somewhere in your path, and make it executable.

## Usage

When you execute `op`, Opcode will look for a file named `op.conf` (or opcode)
When you execute `op`, Opcode will look for a file named `opcode` or `op.conf`
in the current directory. See the [example/op.conf](example/op.conf) file
for reference.

Expand DownExpand Up@@ -90,13 +90,50 @@ Usage:
op -a, --add CODE COMMAND...
Append a command to the config file

op -c, --config FILE CODE [ARGS]
Use a specific config file

op -h, --help
Show this message

op -v, --version
Show version number
```

## Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

## Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -247,6 +284,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

## Uninstalling

```shell
Expand Down
74 changes: 58 additions & 16 deletions doc/op.1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.2
.\" Automatically generated by Pandoc 3.9
.\"
.TH "op" "1" "July 2024" "Version 1.1.1" "local command shortcuts"
.TH "op" "1" "May 2026" "Version 1.1.1" "local command shortcuts"
.SH NAME
\f[B]op\f[R] \- local command shortcuts
.SH SYNOPSIS
Expand DownExpand Up@@ -28,13 +28,15 @@ Show the command for a given code
Open the config file for editing
.SS \-\-add, \-a CODE COMMAND...
Append a command to the config file
.SS \-\-config, \-c FILE CODE [ARGS]
Use a specific config file
.SS \-\-help, \-h
Show help message
.SS \-\-version, \-v
Show version number
.SH OPCODE FILE
Running \f[B]op\f[R] will look for a file named \f[B]op.conf\f[R] or
\f[B]opcode\f[R] in the working directory.
Running \f[B]op\f[R] will look for a file named \f[B]opcode\f[R] or
\f[B]op.conf\f[R] in the working directory.
.PP
The syntax of this file is simple \- each line should contain a code and
the command to run:
Expand All@@ -46,7 +48,7 @@ code: command to run
For example:
.IP
.EX
commit: git commit \-am \[dq]quick commit\[dq]
commit: git commit \-am \(dqquick commit\(dq
.EE
.PP
With this configuration, you can now simply run:
Expand All@@ -59,14 +61,48 @@ Any argument provided to the CLI will be forwarded to the command, so
with this configuration:
.IP
.EX
commit: git commit \-am \[dq]$\[at]\[dq]
commit: git commit \-am \(dq$\(at\(dq
.EE
.PP
You can supply a commit message:
.IP
.EX
$ op commit \[dq]my commit message\[dq]
$ op commit \(dqmy commit message\(dq
.EE
.SS Config Selection
Use \f[CR]\-c, \-\-config\f[R] or \f[CR]OPCODE_CONFIG\f[R] to run
commands from a specific config file:
.IP
.EX
$ op \-c agent.op.conf check
$ op \-\-config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
.EE
.PP
The \f[CR]\-c, \-\-config\f[R] flag must appear before the command code.
Any \f[CR]\-c\f[R] that appears after the command code is passed through
to the command as an argument.
The flag has precedence over \f[CR]OPCODE_CONFIG\f[R].
.PP
You can also create another local command namespace by symlinking
\f[CR]op\f[R] under a different name:
.IP
.EX
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln \-s op agent
$ agent check
.EE
.PP
A renamed executable uses its own config files:
.IP
.EX
agent \-> agent.op.conf, agent.conf
.EE
.PP
The \f[CR].op.conf\f[R] file is preferred when both files exist.
A renamed executable does not fall back to \f[CR]opcode\f[R] or
\f[CR]op.conf\f[R]; this keeps separately named catalogs from
accidentally running commands from the main \f[CR]op\f[R] namespace.
.SS Multiline Commands
In order to specify multiple commands for a single code, provide the
commands indented with one or more spaces immediately under the command
Expand All@@ -83,25 +119,25 @@ your file.
.SS Positional Arguments
Any excess argument provided when running \f[CR]op CODE\f[R] will be
available to you as they normally would in a bash script.
You can access all of them by using \f[CR]$\[at]\f[R], or the individual
You can access all of them by using \f[CR]$\(at\f[R], or the individual
arguments at \f[CR]$1\f[R], \f[CR]$2\f[R] etc.
.PP
Given this configuration:
.IP
.EX
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
.EE
.PP
You can now run:
.IP
.EX
$ op deploy \[dq]version 1.1.1\[dq]
$ op deploy \(dqversion 1.1.1\(dq
.EE
.PP
and it will be translated to this command
.IP
.EX
git commit \-am \[dq]version 1.1.1\[dq] && git push
git commit \-am \(dqversion 1.1.1\(dq && git push
.EE
.SS Usage Comments
You may add special usage comments in your \f[CR]op.conf\f[R] file.
Expand All@@ -114,7 +150,7 @@ For example, this configuration file:
.IP
.EX
# op.conf
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
#? perform git commit and push.
#? usage: op deploy COMMIT_MESSAGE

Expand DownExpand Up@@ -145,7 +181,7 @@ For example, this configuration file:

## Testing Commands

test: rspec \[dq]$\[at]\[dq]
test: rspec \(dq$\(at\(dq
#? Run tests

## Git Commands
Expand DownExpand Up@@ -193,7 +229,7 @@ code you typed.
In other words, if you have this in your \f[CR]op.conf\f[R] file:
.IP
.EX
server: echo \[dq]Running Server\[dq] && rackup
server: echo \(dqRunning Server\(dq && rackup
.EE
.PP
You can run it with \f[B]op server\f[R], \f[B]op s\f[R] and anything in
Expand All@@ -205,10 +241,16 @@ If you install opcode using the setup script, bash completion will be
installed automatically.
.PP
If you install opcode manually, and would like to enable bash
completion, simply add this to your \f[CR]\[ti]/.bashrc\f[R]:
completion, simply add this to your \f[CR]\(ti/.bashrc\f[R]:
.IP
.EX
complete \-C \(aqop \-\-completion\(aq op
.EE
.PP
For a renamed executable, install completion with the same name:
.IP
.EX
complete \-C \[aq]op \-\-completion\[aq] op
complete \-C \(aqagent \-\-completion\(aq agent
.EE
.SH SOURCE CODE
https://github.com/dannyben/opcode
Expand Down
46 changes: 44 additions & 2 deletions doc/op.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,9 @@ Open the config file for editing
## --add, -a CODE COMMAND...
Append a command to the config file

## --config, -c FILE CODE [ARGS]
Use a specific config file

## --help, -h
Show help message

Expand All@@ -51,7 +54,7 @@ Show version number
OPCODE FILE
==================================================

Running **op** will look for a file named **op.conf** or **opcode** in the
Running **op** will look for a file named **opcode** or **op.conf** in the
working directory.

The syntax of this file is simple - each line should contain a code and the
Expand DownExpand Up@@ -86,6 +89,40 @@ You can supply a commit message:
$ op commit "my commit message"
```

### Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

### Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -242,6 +279,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

SOURCE CODE
==================================================

Expand All@@ -251,4 +294,3 @@ ISSUE TRACKER
==================================================

https://github.com/dannyben/opcode/issues

Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Add executable namespace by DannyBen · Pull Request #41 · DannyBen/opcode · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ place it somewhere in your path, and make it executable.

## Usage

When you execute `op`, Opcode will look for a file named `op.conf` (or opcode)
When you execute `op`, Opcode will look for a file named `opcode` or `op.conf`
in the current directory. See the [example/op.conf](example/op.conf) file
for reference.

Expand DownExpand Up@@ -90,13 +90,50 @@ Usage:
op -a, --add CODE COMMAND...
Append a command to the config file

op -c, --config FILE CODE [ARGS]
Use a specific config file

op -h, --help
Show this message

op -v, --version
Show version number
```

## Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

## Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -247,6 +284,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

## Uninstalling

```shell
Expand Down
74 changes: 58 additions & 16 deletions doc/op.1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.2
.\" Automatically generated by Pandoc 3.9
.\"
.TH "op" "1" "July 2024" "Version 1.1.1" "local command shortcuts"
.TH "op" "1" "May 2026" "Version 1.1.1" "local command shortcuts"
.SH NAME
\f[B]op\f[R] \- local command shortcuts
.SH SYNOPSIS
Expand DownExpand Up@@ -28,13 +28,15 @@ Show the command for a given code
Open the config file for editing
.SS \-\-add, \-a CODE COMMAND...
Append a command to the config file
.SS \-\-config, \-c FILE CODE [ARGS]
Use a specific config file
.SS \-\-help, \-h
Show help message
.SS \-\-version, \-v
Show version number
.SH OPCODE FILE
Running \f[B]op\f[R] will look for a file named \f[B]op.conf\f[R] or
\f[B]opcode\f[R] in the working directory.
Running \f[B]op\f[R] will look for a file named \f[B]opcode\f[R] or
\f[B]op.conf\f[R] in the working directory.
.PP
The syntax of this file is simple \- each line should contain a code and
the command to run:
Expand All@@ -46,7 +48,7 @@ code: command to run
For example:
.IP
.EX
commit: git commit \-am \[dq]quick commit\[dq]
commit: git commit \-am \(dqquick commit\(dq
.EE
.PP
With this configuration, you can now simply run:
Expand All@@ -59,14 +61,48 @@ Any argument provided to the CLI will be forwarded to the command, so
with this configuration:
.IP
.EX
commit: git commit \-am \[dq]$\[at]\[dq]
commit: git commit \-am \(dq$\(at\(dq
.EE
.PP
You can supply a commit message:
.IP
.EX
$ op commit \[dq]my commit message\[dq]
$ op commit \(dqmy commit message\(dq
.EE
.SS Config Selection
Use \f[CR]\-c, \-\-config\f[R] or \f[CR]OPCODE_CONFIG\f[R] to run
commands from a specific config file:
.IP
.EX
$ op \-c agent.op.conf check
$ op \-\-config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
.EE
.PP
The \f[CR]\-c, \-\-config\f[R] flag must appear before the command code.
Any \f[CR]\-c\f[R] that appears after the command code is passed through
to the command as an argument.
The flag has precedence over \f[CR]OPCODE_CONFIG\f[R].
.PP
You can also create another local command namespace by symlinking
\f[CR]op\f[R] under a different name:
.IP
.EX
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln \-s op agent
$ agent check
.EE
.PP
A renamed executable uses its own config files:
.IP
.EX
agent \-> agent.op.conf, agent.conf
.EE
.PP
The \f[CR].op.conf\f[R] file is preferred when both files exist.
A renamed executable does not fall back to \f[CR]opcode\f[R] or
\f[CR]op.conf\f[R]; this keeps separately named catalogs from
accidentally running commands from the main \f[CR]op\f[R] namespace.
.SS Multiline Commands
In order to specify multiple commands for a single code, provide the
commands indented with one or more spaces immediately under the command
Expand All@@ -83,25 +119,25 @@ your file.
.SS Positional Arguments
Any excess argument provided when running \f[CR]op CODE\f[R] will be
available to you as they normally would in a bash script.
You can access all of them by using \f[CR]$\[at]\f[R], or the individual
You can access all of them by using \f[CR]$\(at\f[R], or the individual
arguments at \f[CR]$1\f[R], \f[CR]$2\f[R] etc.
.PP
Given this configuration:
.IP
.EX
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
.EE
.PP
You can now run:
.IP
.EX
$ op deploy \[dq]version 1.1.1\[dq]
$ op deploy \(dqversion 1.1.1\(dq
.EE
.PP
and it will be translated to this command
.IP
.EX
git commit \-am \[dq]version 1.1.1\[dq] && git push
git commit \-am \(dqversion 1.1.1\(dq && git push
.EE
.SS Usage Comments
You may add special usage comments in your \f[CR]op.conf\f[R] file.
Expand All@@ -114,7 +150,7 @@ For example, this configuration file:
.IP
.EX
# op.conf
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
#? perform git commit and push.
#? usage: op deploy COMMIT_MESSAGE

Expand DownExpand Up@@ -145,7 +181,7 @@ For example, this configuration file:

## Testing Commands

test: rspec \[dq]$\[at]\[dq]
test: rspec \(dq$\(at\(dq
#? Run tests

## Git Commands
Expand DownExpand Up@@ -193,7 +229,7 @@ code you typed.
In other words, if you have this in your \f[CR]op.conf\f[R] file:
.IP
.EX
server: echo \[dq]Running Server\[dq] && rackup
server: echo \(dqRunning Server\(dq && rackup
.EE
.PP
You can run it with \f[B]op server\f[R], \f[B]op s\f[R] and anything in
Expand All@@ -205,10 +241,16 @@ If you install opcode using the setup script, bash completion will be
installed automatically.
.PP
If you install opcode manually, and would like to enable bash
completion, simply add this to your \f[CR]\[ti]/.bashrc\f[R]:
completion, simply add this to your \f[CR]\(ti/.bashrc\f[R]:
.IP
.EX
complete \-C \(aqop \-\-completion\(aq op
.EE
.PP
For a renamed executable, install completion with the same name:
.IP
.EX
complete \-C \[aq]op \-\-completion\[aq] op
complete \-C \(aqagent \-\-completion\(aq agent
.EE
.SH SOURCE CODE
https://github.com/dannyben/opcode
Expand Down
46 changes: 44 additions & 2 deletions doc/op.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,9 @@ Open the config file for editing
## --add, -a CODE COMMAND...
Append a command to the config file

## --config, -c FILE CODE [ARGS]
Use a specific config file

## --help, -h
Show help message

Expand All@@ -51,7 +54,7 @@ Show version number
OPCODE FILE
==================================================

Running **op** will look for a file named **op.conf** or **opcode** in the
Running **op** will look for a file named **opcode** or **op.conf** in the
working directory.

The syntax of this file is simple - each line should contain a code and the
Expand DownExpand Up@@ -86,6 +89,40 @@ You can supply a commit message:
$ op commit "my commit message"
```

### Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

### Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -242,6 +279,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

SOURCE CODE
==================================================

Expand All@@ -251,4 +294,3 @@ ISSUE TRACKER
==================================================

https://github.com/dannyben/opcode/issues

Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add executable namespace by DannyBen · Pull Request #41 · DannyBen/opcode · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ place it somewhere in your path, and make it executable.

## Usage

When you execute `op`, Opcode will look for a file named `op.conf` (or opcode)
When you execute `op`, Opcode will look for a file named `opcode` or `op.conf`
in the current directory. See the [example/op.conf](example/op.conf) file
for reference.

Expand DownExpand Up@@ -90,13 +90,50 @@ Usage:
op -a, --add CODE COMMAND...
Append a command to the config file

op -c, --config FILE CODE [ARGS]
Use a specific config file

op -h, --help
Show this message

op -v, --version
Show version number
```

## Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

## Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -247,6 +284,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

## Uninstalling

```shell
Expand Down
74 changes: 58 additions & 16 deletions doc/op.1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.2
.\" Automatically generated by Pandoc 3.9
.\"
.TH "op" "1" "July 2024" "Version 1.1.1" "local command shortcuts"
.TH "op" "1" "May 2026" "Version 1.1.1" "local command shortcuts"
.SH NAME
\f[B]op\f[R] \- local command shortcuts
.SH SYNOPSIS
Expand DownExpand Up@@ -28,13 +28,15 @@ Show the command for a given code
Open the config file for editing
.SS \-\-add, \-a CODE COMMAND...
Append a command to the config file
.SS \-\-config, \-c FILE CODE [ARGS]
Use a specific config file
.SS \-\-help, \-h
Show help message
.SS \-\-version, \-v
Show version number
.SH OPCODE FILE
Running \f[B]op\f[R] will look for a file named \f[B]op.conf\f[R] or
\f[B]opcode\f[R] in the working directory.
Running \f[B]op\f[R] will look for a file named \f[B]opcode\f[R] or
\f[B]op.conf\f[R] in the working directory.
.PP
The syntax of this file is simple \- each line should contain a code and
the command to run:
Expand All@@ -46,7 +48,7 @@ code: command to run
For example:
.IP
.EX
commit: git commit \-am \[dq]quick commit\[dq]
commit: git commit \-am \(dqquick commit\(dq
.EE
.PP
With this configuration, you can now simply run:
Expand All@@ -59,14 +61,48 @@ Any argument provided to the CLI will be forwarded to the command, so
with this configuration:
.IP
.EX
commit: git commit \-am \[dq]$\[at]\[dq]
commit: git commit \-am \(dq$\(at\(dq
.EE
.PP
You can supply a commit message:
.IP
.EX
$ op commit \[dq]my commit message\[dq]
$ op commit \(dqmy commit message\(dq
.EE
.SS Config Selection
Use \f[CR]\-c, \-\-config\f[R] or \f[CR]OPCODE_CONFIG\f[R] to run
commands from a specific config file:
.IP
.EX
$ op \-c agent.op.conf check
$ op \-\-config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
.EE
.PP
The \f[CR]\-c, \-\-config\f[R] flag must appear before the command code.
Any \f[CR]\-c\f[R] that appears after the command code is passed through
to the command as an argument.
The flag has precedence over \f[CR]OPCODE_CONFIG\f[R].
.PP
You can also create another local command namespace by symlinking
\f[CR]op\f[R] under a different name:
.IP
.EX
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln \-s op agent
$ agent check
.EE
.PP
A renamed executable uses its own config files:
.IP
.EX
agent \-> agent.op.conf, agent.conf
.EE
.PP
The \f[CR].op.conf\f[R] file is preferred when both files exist.
A renamed executable does not fall back to \f[CR]opcode\f[R] or
\f[CR]op.conf\f[R]; this keeps separately named catalogs from
accidentally running commands from the main \f[CR]op\f[R] namespace.
.SS Multiline Commands
In order to specify multiple commands for a single code, provide the
commands indented with one or more spaces immediately under the command
Expand All@@ -83,25 +119,25 @@ your file.
.SS Positional Arguments
Any excess argument provided when running \f[CR]op CODE\f[R] will be
available to you as they normally would in a bash script.
You can access all of them by using \f[CR]$\[at]\f[R], or the individual
You can access all of them by using \f[CR]$\(at\f[R], or the individual
arguments at \f[CR]$1\f[R], \f[CR]$2\f[R] etc.
.PP
Given this configuration:
.IP
.EX
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
.EE
.PP
You can now run:
.IP
.EX
$ op deploy \[dq]version 1.1.1\[dq]
$ op deploy \(dqversion 1.1.1\(dq
.EE
.PP
and it will be translated to this command
.IP
.EX
git commit \-am \[dq]version 1.1.1\[dq] && git push
git commit \-am \(dqversion 1.1.1\(dq && git push
.EE
.SS Usage Comments
You may add special usage comments in your \f[CR]op.conf\f[R] file.
Expand All@@ -114,7 +150,7 @@ For example, this configuration file:
.IP
.EX
# op.conf
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
#? perform git commit and push.
#? usage: op deploy COMMIT_MESSAGE

Expand DownExpand Up@@ -145,7 +181,7 @@ For example, this configuration file:

## Testing Commands

test: rspec \[dq]$\[at]\[dq]
test: rspec \(dq$\(at\(dq
#? Run tests

## Git Commands
Expand DownExpand Up@@ -193,7 +229,7 @@ code you typed.
In other words, if you have this in your \f[CR]op.conf\f[R] file:
.IP
.EX
server: echo \[dq]Running Server\[dq] && rackup
server: echo \(dqRunning Server\(dq && rackup
.EE
.PP
You can run it with \f[B]op server\f[R], \f[B]op s\f[R] and anything in
Expand All@@ -205,10 +241,16 @@ If you install opcode using the setup script, bash completion will be
installed automatically.
.PP
If you install opcode manually, and would like to enable bash
completion, simply add this to your \f[CR]\[ti]/.bashrc\f[R]:
completion, simply add this to your \f[CR]\(ti/.bashrc\f[R]:
.IP
.EX
complete \-C \(aqop \-\-completion\(aq op
.EE
.PP
For a renamed executable, install completion with the same name:
.IP
.EX
complete \-C \[aq]op \-\-completion\[aq] op
complete \-C \(aqagent \-\-completion\(aq agent
.EE
.SH SOURCE CODE
https://github.com/dannyben/opcode
Expand Down
46 changes: 44 additions & 2 deletions doc/op.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,9 @@ Open the config file for editing
## --add, -a CODE COMMAND...
Append a command to the config file

## --config, -c FILE CODE [ARGS]
Use a specific config file

## --help, -h
Show help message

Expand All@@ -51,7 +54,7 @@ Show version number
OPCODE FILE
==================================================

Running **op** will look for a file named **op.conf** or **opcode** in the
Running **op** will look for a file named **opcode** or **op.conf** in the
working directory.

The syntax of this file is simple - each line should contain a code and the
Expand DownExpand Up@@ -86,6 +89,40 @@ You can supply a commit message:
$ op commit "my commit message"
```

### Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

### Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -242,6 +279,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

SOURCE CODE
==================================================

Expand All@@ -251,4 +294,3 @@ ISSUE TRACKER
==================================================

https://github.com/dannyben/opcode/issues

Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add executable namespace by DannyBen · Pull Request #41 · DannyBen/opcode · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ place it somewhere in your path, and make it executable.

## Usage

When you execute `op`, Opcode will look for a file named `op.conf` (or opcode)
When you execute `op`, Opcode will look for a file named `opcode` or `op.conf`
in the current directory. See the [example/op.conf](example/op.conf) file
for reference.

Expand DownExpand Up@@ -90,13 +90,50 @@ Usage:
op -a, --add CODE COMMAND...
Append a command to the config file

op -c, --config FILE CODE [ARGS]
Use a specific config file

op -h, --help
Show this message

op -v, --version
Show version number
```

## Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

## Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -247,6 +284,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

## Uninstalling

```shell
Expand Down
74 changes: 58 additions & 16 deletions doc/op.1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.2
.\" Automatically generated by Pandoc 3.9
.\"
.TH "op" "1" "July 2024" "Version 1.1.1" "local command shortcuts"
.TH "op" "1" "May 2026" "Version 1.1.1" "local command shortcuts"
.SH NAME
\f[B]op\f[R] \- local command shortcuts
.SH SYNOPSIS
Expand DownExpand Up@@ -28,13 +28,15 @@ Show the command for a given code
Open the config file for editing
.SS \-\-add, \-a CODE COMMAND...
Append a command to the config file
.SS \-\-config, \-c FILE CODE [ARGS]
Use a specific config file
.SS \-\-help, \-h
Show help message
.SS \-\-version, \-v
Show version number
.SH OPCODE FILE
Running \f[B]op\f[R] will look for a file named \f[B]op.conf\f[R] or
\f[B]opcode\f[R] in the working directory.
Running \f[B]op\f[R] will look for a file named \f[B]opcode\f[R] or
\f[B]op.conf\f[R] in the working directory.
.PP
The syntax of this file is simple \- each line should contain a code and
the command to run:
Expand All@@ -46,7 +48,7 @@ code: command to run
For example:
.IP
.EX
commit: git commit \-am \[dq]quick commit\[dq]
commit: git commit \-am \(dqquick commit\(dq
.EE
.PP
With this configuration, you can now simply run:
Expand All@@ -59,14 +61,48 @@ Any argument provided to the CLI will be forwarded to the command, so
with this configuration:
.IP
.EX
commit: git commit \-am \[dq]$\[at]\[dq]
commit: git commit \-am \(dq$\(at\(dq
.EE
.PP
You can supply a commit message:
.IP
.EX
$ op commit \[dq]my commit message\[dq]
$ op commit \(dqmy commit message\(dq
.EE
.SS Config Selection
Use \f[CR]\-c, \-\-config\f[R] or \f[CR]OPCODE_CONFIG\f[R] to run
commands from a specific config file:
.IP
.EX
$ op \-c agent.op.conf check
$ op \-\-config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
.EE
.PP
The \f[CR]\-c, \-\-config\f[R] flag must appear before the command code.
Any \f[CR]\-c\f[R] that appears after the command code is passed through
to the command as an argument.
The flag has precedence over \f[CR]OPCODE_CONFIG\f[R].
.PP
You can also create another local command namespace by symlinking
\f[CR]op\f[R] under a different name:
.IP
.EX
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln \-s op agent
$ agent check
.EE
.PP
A renamed executable uses its own config files:
.IP
.EX
agent \-> agent.op.conf, agent.conf
.EE
.PP
The \f[CR].op.conf\f[R] file is preferred when both files exist.
A renamed executable does not fall back to \f[CR]opcode\f[R] or
\f[CR]op.conf\f[R]; this keeps separately named catalogs from
accidentally running commands from the main \f[CR]op\f[R] namespace.
.SS Multiline Commands
In order to specify multiple commands for a single code, provide the
commands indented with one or more spaces immediately under the command
Expand All@@ -83,25 +119,25 @@ your file.
.SS Positional Arguments
Any excess argument provided when running \f[CR]op CODE\f[R] will be
available to you as they normally would in a bash script.
You can access all of them by using \f[CR]$\[at]\f[R], or the individual
You can access all of them by using \f[CR]$\(at\f[R], or the individual
arguments at \f[CR]$1\f[R], \f[CR]$2\f[R] etc.
.PP
Given this configuration:
.IP
.EX
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
.EE
.PP
You can now run:
.IP
.EX
$ op deploy \[dq]version 1.1.1\[dq]
$ op deploy \(dqversion 1.1.1\(dq
.EE
.PP
and it will be translated to this command
.IP
.EX
git commit \-am \[dq]version 1.1.1\[dq] && git push
git commit \-am \(dqversion 1.1.1\(dq && git push
.EE
.SS Usage Comments
You may add special usage comments in your \f[CR]op.conf\f[R] file.
Expand All@@ -114,7 +150,7 @@ For example, this configuration file:
.IP
.EX
# op.conf
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
#? perform git commit and push.
#? usage: op deploy COMMIT_MESSAGE

Expand DownExpand Up@@ -145,7 +181,7 @@ For example, this configuration file:

## Testing Commands

test: rspec \[dq]$\[at]\[dq]
test: rspec \(dq$\(at\(dq
#? Run tests

## Git Commands
Expand DownExpand Up@@ -193,7 +229,7 @@ code you typed.
In other words, if you have this in your \f[CR]op.conf\f[R] file:
.IP
.EX
server: echo \[dq]Running Server\[dq] && rackup
server: echo \(dqRunning Server\(dq && rackup
.EE
.PP
You can run it with \f[B]op server\f[R], \f[B]op s\f[R] and anything in
Expand All@@ -205,10 +241,16 @@ If you install opcode using the setup script, bash completion will be
installed automatically.
.PP
If you install opcode manually, and would like to enable bash
completion, simply add this to your \f[CR]\[ti]/.bashrc\f[R]:
completion, simply add this to your \f[CR]\(ti/.bashrc\f[R]:
.IP
.EX
complete \-C \(aqop \-\-completion\(aq op
.EE
.PP
For a renamed executable, install completion with the same name:
.IP
.EX
complete \-C \[aq]op \-\-completion\[aq] op
complete \-C \(aqagent \-\-completion\(aq agent
.EE
.SH SOURCE CODE
https://github.com/dannyben/opcode
Expand Down
46 changes: 44 additions & 2 deletions doc/op.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,9 @@ Open the config file for editing
## --add, -a CODE COMMAND...
Append a command to the config file

## --config, -c FILE CODE [ARGS]
Use a specific config file

## --help, -h
Show help message

Expand All@@ -51,7 +54,7 @@ Show version number
OPCODE FILE
==================================================

Running **op** will look for a file named **op.conf** or **opcode** in the
Running **op** will look for a file named **opcode** or **op.conf** in the
working directory.

The syntax of this file is simple - each line should contain a code and the
Expand DownExpand Up@@ -86,6 +89,40 @@ You can supply a commit message:
$ op commit "my commit message"
```

### Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

### Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -242,6 +279,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

SOURCE CODE
==================================================

Expand All@@ -251,4 +294,3 @@ ISSUE TRACKER
==================================================

https://github.com/dannyben/opcode/issues

Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Add executable namespace by DannyBen · Pull Request #41 · DannyBen/opcode · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ place it somewhere in your path, and make it executable.

## Usage

When you execute `op`, Opcode will look for a file named `op.conf` (or opcode)
When you execute `op`, Opcode will look for a file named `opcode` or `op.conf`
in the current directory. See the [example/op.conf](example/op.conf) file
for reference.

Expand DownExpand Up@@ -90,13 +90,50 @@ Usage:
op -a, --add CODE COMMAND...
Append a command to the config file

op -c, --config FILE CODE [ARGS]
Use a specific config file

op -h, --help
Show this message

op -v, --version
Show version number
```

## Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

## Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -247,6 +284,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

## Uninstalling

```shell
Expand Down
74 changes: 58 additions & 16 deletions doc/op.1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.2
.\" Automatically generated by Pandoc 3.9
.\"
.TH "op" "1" "July 2024" "Version 1.1.1" "local command shortcuts"
.TH "op" "1" "May 2026" "Version 1.1.1" "local command shortcuts"
.SH NAME
\f[B]op\f[R] \- local command shortcuts
.SH SYNOPSIS
Expand DownExpand Up@@ -28,13 +28,15 @@ Show the command for a given code
Open the config file for editing
.SS \-\-add, \-a CODE COMMAND...
Append a command to the config file
.SS \-\-config, \-c FILE CODE [ARGS]
Use a specific config file
.SS \-\-help, \-h
Show help message
.SS \-\-version, \-v
Show version number
.SH OPCODE FILE
Running \f[B]op\f[R] will look for a file named \f[B]op.conf\f[R] or
\f[B]opcode\f[R] in the working directory.
Running \f[B]op\f[R] will look for a file named \f[B]opcode\f[R] or
\f[B]op.conf\f[R] in the working directory.
.PP
The syntax of this file is simple \- each line should contain a code and
the command to run:
Expand All@@ -46,7 +48,7 @@ code: command to run
For example:
.IP
.EX
commit: git commit \-am \[dq]quick commit\[dq]
commit: git commit \-am \(dqquick commit\(dq
.EE
.PP
With this configuration, you can now simply run:
Expand All@@ -59,14 +61,48 @@ Any argument provided to the CLI will be forwarded to the command, so
with this configuration:
.IP
.EX
commit: git commit \-am \[dq]$\[at]\[dq]
commit: git commit \-am \(dq$\(at\(dq
.EE
.PP
You can supply a commit message:
.IP
.EX
$ op commit \[dq]my commit message\[dq]
$ op commit \(dqmy commit message\(dq
.EE
.SS Config Selection
Use \f[CR]\-c, \-\-config\f[R] or \f[CR]OPCODE_CONFIG\f[R] to run
commands from a specific config file:
.IP
.EX
$ op \-c agent.op.conf check
$ op \-\-config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
.EE
.PP
The \f[CR]\-c, \-\-config\f[R] flag must appear before the command code.
Any \f[CR]\-c\f[R] that appears after the command code is passed through
to the command as an argument.
The flag has precedence over \f[CR]OPCODE_CONFIG\f[R].
.PP
You can also create another local command namespace by symlinking
\f[CR]op\f[R] under a different name:
.IP
.EX
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln \-s op agent
$ agent check
.EE
.PP
A renamed executable uses its own config files:
.IP
.EX
agent \-> agent.op.conf, agent.conf
.EE
.PP
The \f[CR].op.conf\f[R] file is preferred when both files exist.
A renamed executable does not fall back to \f[CR]opcode\f[R] or
\f[CR]op.conf\f[R]; this keeps separately named catalogs from
accidentally running commands from the main \f[CR]op\f[R] namespace.
.SS Multiline Commands
In order to specify multiple commands for a single code, provide the
commands indented with one or more spaces immediately under the command
Expand All@@ -83,25 +119,25 @@ your file.
.SS Positional Arguments
Any excess argument provided when running \f[CR]op CODE\f[R] will be
available to you as they normally would in a bash script.
You can access all of them by using \f[CR]$\[at]\f[R], or the individual
You can access all of them by using \f[CR]$\(at\f[R], or the individual
arguments at \f[CR]$1\f[R], \f[CR]$2\f[R] etc.
.PP
Given this configuration:
.IP
.EX
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
.EE
.PP
You can now run:
.IP
.EX
$ op deploy \[dq]version 1.1.1\[dq]
$ op deploy \(dqversion 1.1.1\(dq
.EE
.PP
and it will be translated to this command
.IP
.EX
git commit \-am \[dq]version 1.1.1\[dq] && git push
git commit \-am \(dqversion 1.1.1\(dq && git push
.EE
.SS Usage Comments
You may add special usage comments in your \f[CR]op.conf\f[R] file.
Expand All@@ -114,7 +150,7 @@ For example, this configuration file:
.IP
.EX
# op.conf
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
#? perform git commit and push.
#? usage: op deploy COMMIT_MESSAGE

Expand DownExpand Up@@ -145,7 +181,7 @@ For example, this configuration file:

## Testing Commands

test: rspec \[dq]$\[at]\[dq]
test: rspec \(dq$\(at\(dq
#? Run tests

## Git Commands
Expand DownExpand Up@@ -193,7 +229,7 @@ code you typed.
In other words, if you have this in your \f[CR]op.conf\f[R] file:
.IP
.EX
server: echo \[dq]Running Server\[dq] && rackup
server: echo \(dqRunning Server\(dq && rackup
.EE
.PP
You can run it with \f[B]op server\f[R], \f[B]op s\f[R] and anything in
Expand All@@ -205,10 +241,16 @@ If you install opcode using the setup script, bash completion will be
installed automatically.
.PP
If you install opcode manually, and would like to enable bash
completion, simply add this to your \f[CR]\[ti]/.bashrc\f[R]:
completion, simply add this to your \f[CR]\(ti/.bashrc\f[R]:
.IP
.EX
complete \-C \(aqop \-\-completion\(aq op
.EE
.PP
For a renamed executable, install completion with the same name:
.IP
.EX
complete \-C \[aq]op \-\-completion\[aq] op
complete \-C \(aqagent \-\-completion\(aq agent
.EE
.SH SOURCE CODE
https://github.com/dannyben/opcode
Expand Down
46 changes: 44 additions & 2 deletions doc/op.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,9 @@ Open the config file for editing
## --add, -a CODE COMMAND...
Append a command to the config file

## --config, -c FILE CODE [ARGS]
Use a specific config file

## --help, -h
Show help message

Expand All@@ -51,7 +54,7 @@ Show version number
OPCODE FILE
==================================================

Running **op** will look for a file named **op.conf** or **opcode** in the
Running **op** will look for a file named **opcode** or **op.conf** in the
working directory.

The syntax of this file is simple - each line should contain a code and the
Expand DownExpand Up@@ -86,6 +89,40 @@ You can supply a commit message:
$ op commit "my commit message"
```

### Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

### Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -242,6 +279,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

SOURCE CODE
==================================================

Expand All@@ -251,4 +294,3 @@ ISSUE TRACKER
==================================================

https://github.com/dannyben/opcode/issues

Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add executable namespace by DannyBen · Pull Request #41 · DannyBen/opcode · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ place it somewhere in your path, and make it executable.

## Usage

When you execute `op`, Opcode will look for a file named `op.conf` (or opcode)
When you execute `op`, Opcode will look for a file named `opcode` or `op.conf`
in the current directory. See the [example/op.conf](example/op.conf) file
for reference.

Expand DownExpand Up@@ -90,13 +90,50 @@ Usage:
op -a, --add CODE COMMAND...
Append a command to the config file

op -c, --config FILE CODE [ARGS]
Use a specific config file

op -h, --help
Show this message

op -v, --version
Show version number
```

## Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

## Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -247,6 +284,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

## Uninstalling

```shell
Expand Down
74 changes: 58 additions & 16 deletions doc/op.1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.2
.\" Automatically generated by Pandoc 3.9
.\"
.TH "op" "1" "July 2024" "Version 1.1.1" "local command shortcuts"
.TH "op" "1" "May 2026" "Version 1.1.1" "local command shortcuts"
.SH NAME
\f[B]op\f[R] \- local command shortcuts
.SH SYNOPSIS
Expand DownExpand Up@@ -28,13 +28,15 @@ Show the command for a given code
Open the config file for editing
.SS \-\-add, \-a CODE COMMAND...
Append a command to the config file
.SS \-\-config, \-c FILE CODE [ARGS]
Use a specific config file
.SS \-\-help, \-h
Show help message
.SS \-\-version, \-v
Show version number
.SH OPCODE FILE
Running \f[B]op\f[R] will look for a file named \f[B]op.conf\f[R] or
\f[B]opcode\f[R] in the working directory.
Running \f[B]op\f[R] will look for a file named \f[B]opcode\f[R] or
\f[B]op.conf\f[R] in the working directory.
.PP
The syntax of this file is simple \- each line should contain a code and
the command to run:
Expand All@@ -46,7 +48,7 @@ code: command to run
For example:
.IP
.EX
commit: git commit \-am \[dq]quick commit\[dq]
commit: git commit \-am \(dqquick commit\(dq
.EE
.PP
With this configuration, you can now simply run:
Expand All@@ -59,14 +61,48 @@ Any argument provided to the CLI will be forwarded to the command, so
with this configuration:
.IP
.EX
commit: git commit \-am \[dq]$\[at]\[dq]
commit: git commit \-am \(dq$\(at\(dq
.EE
.PP
You can supply a commit message:
.IP
.EX
$ op commit \[dq]my commit message\[dq]
$ op commit \(dqmy commit message\(dq
.EE
.SS Config Selection
Use \f[CR]\-c, \-\-config\f[R] or \f[CR]OPCODE_CONFIG\f[R] to run
commands from a specific config file:
.IP
.EX
$ op \-c agent.op.conf check
$ op \-\-config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
.EE
.PP
The \f[CR]\-c, \-\-config\f[R] flag must appear before the command code.
Any \f[CR]\-c\f[R] that appears after the command code is passed through
to the command as an argument.
The flag has precedence over \f[CR]OPCODE_CONFIG\f[R].
.PP
You can also create another local command namespace by symlinking
\f[CR]op\f[R] under a different name:
.IP
.EX
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln \-s op agent
$ agent check
.EE
.PP
A renamed executable uses its own config files:
.IP
.EX
agent \-> agent.op.conf, agent.conf
.EE
.PP
The \f[CR].op.conf\f[R] file is preferred when both files exist.
A renamed executable does not fall back to \f[CR]opcode\f[R] or
\f[CR]op.conf\f[R]; this keeps separately named catalogs from
accidentally running commands from the main \f[CR]op\f[R] namespace.
.SS Multiline Commands
In order to specify multiple commands for a single code, provide the
commands indented with one or more spaces immediately under the command
Expand All@@ -83,25 +119,25 @@ your file.
.SS Positional Arguments
Any excess argument provided when running \f[CR]op CODE\f[R] will be
available to you as they normally would in a bash script.
You can access all of them by using \f[CR]$\[at]\f[R], or the individual
You can access all of them by using \f[CR]$\(at\f[R], or the individual
arguments at \f[CR]$1\f[R], \f[CR]$2\f[R] etc.
.PP
Given this configuration:
.IP
.EX
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
.EE
.PP
You can now run:
.IP
.EX
$ op deploy \[dq]version 1.1.1\[dq]
$ op deploy \(dqversion 1.1.1\(dq
.EE
.PP
and it will be translated to this command
.IP
.EX
git commit \-am \[dq]version 1.1.1\[dq] && git push
git commit \-am \(dqversion 1.1.1\(dq && git push
.EE
.SS Usage Comments
You may add special usage comments in your \f[CR]op.conf\f[R] file.
Expand All@@ -114,7 +150,7 @@ For example, this configuration file:
.IP
.EX
# op.conf
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
#? perform git commit and push.
#? usage: op deploy COMMIT_MESSAGE

Expand DownExpand Up@@ -145,7 +181,7 @@ For example, this configuration file:

## Testing Commands

test: rspec \[dq]$\[at]\[dq]
test: rspec \(dq$\(at\(dq
#? Run tests

## Git Commands
Expand DownExpand Up@@ -193,7 +229,7 @@ code you typed.
In other words, if you have this in your \f[CR]op.conf\f[R] file:
.IP
.EX
server: echo \[dq]Running Server\[dq] && rackup
server: echo \(dqRunning Server\(dq && rackup
.EE
.PP
You can run it with \f[B]op server\f[R], \f[B]op s\f[R] and anything in
Expand All@@ -205,10 +241,16 @@ If you install opcode using the setup script, bash completion will be
installed automatically.
.PP
If you install opcode manually, and would like to enable bash
completion, simply add this to your \f[CR]\[ti]/.bashrc\f[R]:
completion, simply add this to your \f[CR]\(ti/.bashrc\f[R]:
.IP
.EX
complete \-C \(aqop \-\-completion\(aq op
.EE
.PP
For a renamed executable, install completion with the same name:
.IP
.EX
complete \-C \[aq]op \-\-completion\[aq] op
complete \-C \(aqagent \-\-completion\(aq agent
.EE
.SH SOURCE CODE
https://github.com/dannyben/opcode
Expand Down
46 changes: 44 additions & 2 deletions doc/op.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,9 @@ Open the config file for editing
## --add, -a CODE COMMAND...
Append a command to the config file

## --config, -c FILE CODE [ARGS]
Use a specific config file

## --help, -h
Show help message

Expand All@@ -51,7 +54,7 @@ Show version number
OPCODE FILE
==================================================

Running **op** will look for a file named **op.conf** or **opcode** in the
Running **op** will look for a file named **opcode** or **op.conf** in the
working directory.

The syntax of this file is simple - each line should contain a code and the
Expand DownExpand Up@@ -86,6 +89,40 @@ You can supply a commit message:
$ op commit "my commit message"
```

### Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

### Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -242,6 +279,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

SOURCE CODE
==================================================

Expand All@@ -251,4 +294,3 @@ ISSUE TRACKER
==================================================

https://github.com/dannyben/opcode/issues

Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add executable namespace by DannyBen · Pull Request #41 · DannyBen/opcode · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ place it somewhere in your path, and make it executable.

## Usage

When you execute `op`, Opcode will look for a file named `op.conf` (or opcode)
When you execute `op`, Opcode will look for a file named `opcode` or `op.conf`
in the current directory. See the [example/op.conf](example/op.conf) file
for reference.

Expand DownExpand Up@@ -90,13 +90,50 @@ Usage:
op -a, --add CODE COMMAND...
Append a command to the config file

op -c, --config FILE CODE [ARGS]
Use a specific config file

op -h, --help
Show this message

op -v, --version
Show version number
```

## Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

## Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -247,6 +284,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

## Uninstalling

```shell
Expand Down
74 changes: 58 additions & 16 deletions doc/op.1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.2
.\" Automatically generated by Pandoc 3.9
.\"
.TH "op" "1" "July 2024" "Version 1.1.1" "local command shortcuts"
.TH "op" "1" "May 2026" "Version 1.1.1" "local command shortcuts"
.SH NAME
\f[B]op\f[R] \- local command shortcuts
.SH SYNOPSIS
Expand DownExpand Up@@ -28,13 +28,15 @@ Show the command for a given code
Open the config file for editing
.SS \-\-add, \-a CODE COMMAND...
Append a command to the config file
.SS \-\-config, \-c FILE CODE [ARGS]
Use a specific config file
.SS \-\-help, \-h
Show help message
.SS \-\-version, \-v
Show version number
.SH OPCODE FILE
Running \f[B]op\f[R] will look for a file named \f[B]op.conf\f[R] or
\f[B]opcode\f[R] in the working directory.
Running \f[B]op\f[R] will look for a file named \f[B]opcode\f[R] or
\f[B]op.conf\f[R] in the working directory.
.PP
The syntax of this file is simple \- each line should contain a code and
the command to run:
Expand All@@ -46,7 +48,7 @@ code: command to run
For example:
.IP
.EX
commit: git commit \-am \[dq]quick commit\[dq]
commit: git commit \-am \(dqquick commit\(dq
.EE
.PP
With this configuration, you can now simply run:
Expand All@@ -59,14 +61,48 @@ Any argument provided to the CLI will be forwarded to the command, so
with this configuration:
.IP
.EX
commit: git commit \-am \[dq]$\[at]\[dq]
commit: git commit \-am \(dq$\(at\(dq
.EE
.PP
You can supply a commit message:
.IP
.EX
$ op commit \[dq]my commit message\[dq]
$ op commit \(dqmy commit message\(dq
.EE
.SS Config Selection
Use \f[CR]\-c, \-\-config\f[R] or \f[CR]OPCODE_CONFIG\f[R] to run
commands from a specific config file:
.IP
.EX
$ op \-c agent.op.conf check
$ op \-\-config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
.EE
.PP
The \f[CR]\-c, \-\-config\f[R] flag must appear before the command code.
Any \f[CR]\-c\f[R] that appears after the command code is passed through
to the command as an argument.
The flag has precedence over \f[CR]OPCODE_CONFIG\f[R].
.PP
You can also create another local command namespace by symlinking
\f[CR]op\f[R] under a different name:
.IP
.EX
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln \-s op agent
$ agent check
.EE
.PP
A renamed executable uses its own config files:
.IP
.EX
agent \-> agent.op.conf, agent.conf
.EE
.PP
The \f[CR].op.conf\f[R] file is preferred when both files exist.
A renamed executable does not fall back to \f[CR]opcode\f[R] or
\f[CR]op.conf\f[R]; this keeps separately named catalogs from
accidentally running commands from the main \f[CR]op\f[R] namespace.
.SS Multiline Commands
In order to specify multiple commands for a single code, provide the
commands indented with one or more spaces immediately under the command
Expand All@@ -83,25 +119,25 @@ your file.
.SS Positional Arguments
Any excess argument provided when running \f[CR]op CODE\f[R] will be
available to you as they normally would in a bash script.
You can access all of them by using \f[CR]$\[at]\f[R], or the individual
You can access all of them by using \f[CR]$\(at\f[R], or the individual
arguments at \f[CR]$1\f[R], \f[CR]$2\f[R] etc.
.PP
Given this configuration:
.IP
.EX
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
.EE
.PP
You can now run:
.IP
.EX
$ op deploy \[dq]version 1.1.1\[dq]
$ op deploy \(dqversion 1.1.1\(dq
.EE
.PP
and it will be translated to this command
.IP
.EX
git commit \-am \[dq]version 1.1.1\[dq] && git push
git commit \-am \(dqversion 1.1.1\(dq && git push
.EE
.SS Usage Comments
You may add special usage comments in your \f[CR]op.conf\f[R] file.
Expand All@@ -114,7 +150,7 @@ For example, this configuration file:
.IP
.EX
# op.conf
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
#? perform git commit and push.
#? usage: op deploy COMMIT_MESSAGE

Expand DownExpand Up@@ -145,7 +181,7 @@ For example, this configuration file:

## Testing Commands

test: rspec \[dq]$\[at]\[dq]
test: rspec \(dq$\(at\(dq
#? Run tests

## Git Commands
Expand DownExpand Up@@ -193,7 +229,7 @@ code you typed.
In other words, if you have this in your \f[CR]op.conf\f[R] file:
.IP
.EX
server: echo \[dq]Running Server\[dq] && rackup
server: echo \(dqRunning Server\(dq && rackup
.EE
.PP
You can run it with \f[B]op server\f[R], \f[B]op s\f[R] and anything in
Expand All@@ -205,10 +241,16 @@ If you install opcode using the setup script, bash completion will be
installed automatically.
.PP
If you install opcode manually, and would like to enable bash
completion, simply add this to your \f[CR]\[ti]/.bashrc\f[R]:
completion, simply add this to your \f[CR]\(ti/.bashrc\f[R]:
.IP
.EX
complete \-C \(aqop \-\-completion\(aq op
.EE
.PP
For a renamed executable, install completion with the same name:
.IP
.EX
complete \-C \[aq]op \-\-completion\[aq] op
complete \-C \(aqagent \-\-completion\(aq agent
.EE
.SH SOURCE CODE
https://github.com/dannyben/opcode
Expand Down
46 changes: 44 additions & 2 deletions doc/op.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,9 @@ Open the config file for editing
## --add, -a CODE COMMAND...
Append a command to the config file

## --config, -c FILE CODE [ARGS]
Use a specific config file

## --help, -h
Show help message

Expand All@@ -51,7 +54,7 @@ Show version number
OPCODE FILE
==================================================

Running **op** will look for a file named **op.conf** or **opcode** in the
Running **op** will look for a file named **opcode** or **op.conf** in the
working directory.

The syntax of this file is simple - each line should contain a code and the
Expand DownExpand Up@@ -86,6 +89,40 @@ You can supply a commit message:
$ op commit "my commit message"
```

### Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

### Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -242,6 +279,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

SOURCE CODE
==================================================

Expand All@@ -251,4 +294,3 @@ ISSUE TRACKER
==================================================

https://github.com/dannyben/opcode/issues

Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); Add executable namespace by DannyBen · Pull Request #41 · DannyBen/opcode · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ place it somewhere in your path, and make it executable.

## Usage

When you execute `op`, Opcode will look for a file named `op.conf` (or opcode)
When you execute `op`, Opcode will look for a file named `opcode` or `op.conf`
in the current directory. See the [example/op.conf](example/op.conf) file
for reference.

Expand DownExpand Up@@ -90,13 +90,50 @@ Usage:
op -a, --add CODE COMMAND...
Append a command to the config file

op -c, --config FILE CODE [ARGS]
Use a specific config file

op -h, --help
Show this message

op -v, --version
Show version number
```

## Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

## Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -247,6 +284,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

## Uninstalling

```shell
Expand Down
74 changes: 58 additions & 16 deletions doc/op.1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.2
.\" Automatically generated by Pandoc 3.9
.\"
.TH "op" "1" "July 2024" "Version 1.1.1" "local command shortcuts"
.TH "op" "1" "May 2026" "Version 1.1.1" "local command shortcuts"
.SH NAME
\f[B]op\f[R] \- local command shortcuts
.SH SYNOPSIS
Expand DownExpand Up@@ -28,13 +28,15 @@ Show the command for a given code
Open the config file for editing
.SS \-\-add, \-a CODE COMMAND...
Append a command to the config file
.SS \-\-config, \-c FILE CODE [ARGS]
Use a specific config file
.SS \-\-help, \-h
Show help message
.SS \-\-version, \-v
Show version number
.SH OPCODE FILE
Running \f[B]op\f[R] will look for a file named \f[B]op.conf\f[R] or
\f[B]opcode\f[R] in the working directory.
Running \f[B]op\f[R] will look for a file named \f[B]opcode\f[R] or
\f[B]op.conf\f[R] in the working directory.
.PP
The syntax of this file is simple \- each line should contain a code and
the command to run:
Expand All@@ -46,7 +48,7 @@ code: command to run
For example:
.IP
.EX
commit: git commit \-am \[dq]quick commit\[dq]
commit: git commit \-am \(dqquick commit\(dq
.EE
.PP
With this configuration, you can now simply run:
Expand All@@ -59,14 +61,48 @@ Any argument provided to the CLI will be forwarded to the command, so
with this configuration:
.IP
.EX
commit: git commit \-am \[dq]$\[at]\[dq]
commit: git commit \-am \(dq$\(at\(dq
.EE
.PP
You can supply a commit message:
.IP
.EX
$ op commit \[dq]my commit message\[dq]
$ op commit \(dqmy commit message\(dq
.EE
.SS Config Selection
Use \f[CR]\-c, \-\-config\f[R] or \f[CR]OPCODE_CONFIG\f[R] to run
commands from a specific config file:
.IP
.EX
$ op \-c agent.op.conf check
$ op \-\-config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
.EE
.PP
The \f[CR]\-c, \-\-config\f[R] flag must appear before the command code.
Any \f[CR]\-c\f[R] that appears after the command code is passed through
to the command as an argument.
The flag has precedence over \f[CR]OPCODE_CONFIG\f[R].
.PP
You can also create another local command namespace by symlinking
\f[CR]op\f[R] under a different name:
.IP
.EX
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln \-s op agent
$ agent check
.EE
.PP
A renamed executable uses its own config files:
.IP
.EX
agent \-> agent.op.conf, agent.conf
.EE
.PP
The \f[CR].op.conf\f[R] file is preferred when both files exist.
A renamed executable does not fall back to \f[CR]opcode\f[R] or
\f[CR]op.conf\f[R]; this keeps separately named catalogs from
accidentally running commands from the main \f[CR]op\f[R] namespace.
.SS Multiline Commands
In order to specify multiple commands for a single code, provide the
commands indented with one or more spaces immediately under the command
Expand All@@ -83,25 +119,25 @@ your file.
.SS Positional Arguments
Any excess argument provided when running \f[CR]op CODE\f[R] will be
available to you as they normally would in a bash script.
You can access all of them by using \f[CR]$\[at]\f[R], or the individual
You can access all of them by using \f[CR]$\(at\f[R], or the individual
arguments at \f[CR]$1\f[R], \f[CR]$2\f[R] etc.
.PP
Given this configuration:
.IP
.EX
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
.EE
.PP
You can now run:
.IP
.EX
$ op deploy \[dq]version 1.1.1\[dq]
$ op deploy \(dqversion 1.1.1\(dq
.EE
.PP
and it will be translated to this command
.IP
.EX
git commit \-am \[dq]version 1.1.1\[dq] && git push
git commit \-am \(dqversion 1.1.1\(dq && git push
.EE
.SS Usage Comments
You may add special usage comments in your \f[CR]op.conf\f[R] file.
Expand All@@ -114,7 +150,7 @@ For example, this configuration file:
.IP
.EX
# op.conf
deploy: git commit \-am \[dq]$1\[dq] && git push
deploy: git commit \-am \(dq$1\(dq && git push
#? perform git commit and push.
#? usage: op deploy COMMIT_MESSAGE

Expand DownExpand Up@@ -145,7 +181,7 @@ For example, this configuration file:

## Testing Commands

test: rspec \[dq]$\[at]\[dq]
test: rspec \(dq$\(at\(dq
#? Run tests

## Git Commands
Expand DownExpand Up@@ -193,7 +229,7 @@ code you typed.
In other words, if you have this in your \f[CR]op.conf\f[R] file:
.IP
.EX
server: echo \[dq]Running Server\[dq] && rackup
server: echo \(dqRunning Server\(dq && rackup
.EE
.PP
You can run it with \f[B]op server\f[R], \f[B]op s\f[R] and anything in
Expand All@@ -205,10 +241,16 @@ If you install opcode using the setup script, bash completion will be
installed automatically.
.PP
If you install opcode manually, and would like to enable bash
completion, simply add this to your \f[CR]\[ti]/.bashrc\f[R]:
completion, simply add this to your \f[CR]\(ti/.bashrc\f[R]:
.IP
.EX
complete \-C \(aqop \-\-completion\(aq op
.EE
.PP
For a renamed executable, install completion with the same name:
.IP
.EX
complete \-C \[aq]op \-\-completion\[aq] op
complete \-C \(aqagent \-\-completion\(aq agent
.EE
.SH SOURCE CODE
https://github.com/dannyben/opcode
Expand Down
46 changes: 44 additions & 2 deletions doc/op.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,9 @@ Open the config file for editing
## --add, -a CODE COMMAND...
Append a command to the config file

## --config, -c FILE CODE [ARGS]
Use a specific config file

## --help, -h
Show help message

Expand All@@ -51,7 +54,7 @@ Show version number
OPCODE FILE
==================================================

Running **op** will look for a file named **op.conf** or **opcode** in the
Running **op** will look for a file named **opcode** or **op.conf** in the
working directory.

The syntax of this file is simple - each line should contain a code and the
Expand DownExpand Up@@ -86,6 +89,40 @@ You can supply a commit message:
$ op commit "my commit message"
```

### Config Selection

Use `-c, --config` or `OPCODE_CONFIG` to run commands from a specific config
file:

```shell
$ op -c agent.op.conf check
$ op --config agent.op.conf check
$ OPCODE_CONFIG=agent.op.conf op check
```

The `-c, --config` flag must appear before the command code. Any `-c` that
appears after the command code is passed through to the command as an argument.
The flag has precedence over `OPCODE_CONFIG`.

You can also create another local command namespace by symlinking `op` under a
different name:

```shell
$ cd /usr/local/bin # or wherever op is installed
$ sudo ln -s op agent
$ agent check
```

A renamed executable uses its own config files:

```text
agent -> agent.op.conf, agent.conf
```

The `.op.conf` file is preferred when both files exist. A renamed executable
does not fall back to `opcode` or `op.conf`; this keeps separately named
catalogs from accidentally running commands from the main `op` namespace.

### Multiline Commands

In order to specify multiple commands for a single code, provide the commands
Expand DownExpand Up@@ -242,6 +279,12 @@ simply add this to your `~/.bashrc`:
complete -C 'op --completion' op
```

For a renamed executable, install completion with the same name:

```shell
complete -C 'agent --completion' agent
```

SOURCE CODE
==================================================

Expand All@@ -251,4 +294,3 @@ ISSUE TRACKER
==================================================

https://github.com/dannyben/opcode/issues

Loading
Loading