Skip to content

Commit 903b8f6

Browse files
committed
tweak api-diff: fix type error on first arg, use dax's new built-in pipe
1 parent a4e15cd commit 903b8f6

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

tools/deno/api-diff.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
import * as flags from 'https://deno.land/std@0.208.0/flags/mod.ts'
1111
import { exists } from 'https://deno.land/std@0.208.0/fs/mod.ts'
12-
import { $, CommandBuilder } from 'https://deno.land/x/dax@0.35.0/mod.ts'
12+
import { $ } from 'https://deno.land/x/dax@0.39.1/mod.ts'
1313

1414
const HELP = `
1515
Display changes to API client caused by a given Omicron PR. Works by downloading
@@ -36,18 +36,6 @@ function printHelpAndExit() {
3636
Deno.exit()
3737
}
3838

39-
// inspired by: https://github.com/dsherret/dax/issues/137#issuecomment-1603848769
40-
declare module 'https://deno.land/x/dax@0.35.0/mod.ts' {
41-
interface CommandBuilder {
42-
pipe(next: CommandBuilder): CommandBuilder
43-
}
44-
}
45-
46-
CommandBuilder.prototype.pipe = function (next: CommandBuilder): CommandBuilder {
47-
const p = this.stdout('piped').spawn()
48-
return next.stdin(p.stdout())
49-
}
50-
5139
// have to do this this way because I couldn't figure out how to get
5240
// my stupid bash function to show up here. I'm sure it's possible
5341
async function pickPr() {
@@ -65,8 +53,10 @@ async function pickPr() {
6553
return prNum
6654
}
6755

68-
async function getCommitRange(arg: string): Promise<{ base: string; head: string }> {
69-
if (!arg || /^\d+$/.test(arg)) {
56+
async function getCommitRange(
57+
arg: string | number | undefined
58+
): Promise<{ base: string; head: string }> {
59+
if (!arg || typeof arg === 'number') {
7060
const prNum = arg || (await pickPr())
7161
const query = `{
7262
repository(owner: "oxidecomputer", name: "omicron") {

0 commit comments

Comments
 (0)