Skip to content

Commit 34918f3

Browse files
fdaciukvmarcosp
authored andcommitted
feat: add option to override globals
1 parent 20a03c7 commit 34918f3

File tree

5 files changed

+35
-20
lines changed

5 files changed

+35
-20
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"packageManager": "[email protected]",
2020
"version": "0.0.12",
2121
"dependencies": {
22-
"@changesets/cli": "^2.27.7"
22+
"@changesets/cli": "^2.27.7",
23+
"typescript": "^5.5.3"
2324
}
2425
}

packages/cli/src/core/GlobalOptions.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ let tap = (opt, fn) => opt->Option.map(value => fn(value))->ignore
22

33
let execute = (options: Config.options) => {
44
options.mouse->tap(v => Tmux.exec(SetGlobal(Mouse(v))))
5-
options.terminalOverrides->tap(v => Tmux.exec(SetGlobal(TerminalOverrides(v))))
65
options.escapeTime->tap(v => Tmux.exec(SetGlobal(EscapeTime(v))))
76
options.paneBaseIndex->tap(v => Tmux.exec(SetGlobal(PaneBaseIndex(v))))
87
options.statusKeys->tap(v => Tmux.exec(SetGlobal(StatusKeys(v))))
@@ -13,6 +12,7 @@ let execute = (options: Config.options) => {
1312
options.baseIndex->tap(v => Tmux.exec(SetGlobal(BaseIndex(v))))
1413
options.historyLimit->tap(v => Tmux.exec(SetGlobal(HistoryLimit(v))))
1514
options.defaultTerminal->tap(v => Tmux.exec(SetGlobal(DefaultTerminal(v))))
15+
options.terminalOverrides->tap(v => Tmux.exec(SetOverrideGlobal(TerminalOverrides(v))))
1616
options.renumberWindows->tap(v => Tmux.exec(SetGlobal(RenumberWindows(v))))
1717
options.aggressiveResize->tap(v => Tmux.exec(SetGlobal(AggressiveResize(v))))
1818
}

packages/cli/src/core/Runner.res

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ type flags<'value> = {file: 'value, version: 'value}
33
let run = async () => {
44
let options: flags<BunX.flag> = {
55
file: {type_: "string"},
6-
version: {type_: "boolean"}
6+
version: {type_: "boolean"},
77
}
88

99
let {values}: BunX.parseArgs<flags<option<string>>> = BunX.parseArgs({
@@ -18,23 +18,23 @@ let run = async () => {
1818
| Some(file) => {
1919
let path = Path.resolve([file])
2020
let {default: config} = await Config.import_(path)
21-
21+
2222
Renderer.render(config)
2323

2424
switch config.options {
25-
| None => ()
26-
| Some(options) => GlobalOptions.execute(options)
25+
| None => ()
26+
| Some(options) => GlobalOptions.execute(options)
2727
}
2828

2929
switch config.bindings {
30-
| None => ()
31-
| Some(bindings) => Bindings.execute(bindings)
30+
| None => ()
31+
| Some(bindings) => Bindings.execute(bindings)
3232
}
3333
}
3434
}
3535

3636
switch values.version {
37-
| None => ()
38-
| Some(_) => Console.log(`better-tmux 🚀`)
37+
| None => ()
38+
| Some(_) => Console.log(`better-tmux 🚀`)
3939
}
4040
}

packages/cli/src/core/Tmux.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type options =
2323

2424
type command =
2525
| SetGlobal(options)
26+
| SetOverrideGlobal(options)
2627
| Bind(string, string, array<string>)
2728

2829
let parseOptions = options =>
@@ -53,6 +54,7 @@ let parseOptions = options =>
5354
let parse = command =>
5455
switch command {
5556
| SetGlobal(options) => `tmux set -g ${options->parseOptions}`
57+
| SetOverrideGlobal(options) => `tmux set -ga ${options->parseOptions}`
5658
| Bind(key, command, options) => `tmux bind ${key} ${command} ${options->Array.join(" ")}`
5759
}
5860

pnpm-lock.yaml

Lines changed: 22 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)