File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ There is an extra subcommand: `cloudflared bin`. You can use it to manage the cl
4747cloudflared bin : Prints the path to the binary
4848cloudflared bin remove : Removes the binary
4949cloudflared bin install [version] : Installs the binary
50+ cloudflared bin list : Lists 30 latest releases
5051cloudflared bin help : Prints this help message
5152Examples:
5253cloudflared bin install : Installs the latest version of cloudflared
Original file line number Diff line number Diff line change 11import fs from "node:fs" ;
2+ import https from "node:https" ;
23import { spawn } from "node:child_process" ;
34import { bin , install } from "./lib.js" ;
45
@@ -25,10 +26,39 @@ export async function main(): Promise<void> {
2526 }
2627 return ;
2728 }
29+ if ( args [ 1 ] === "list" ) {
30+ https . get (
31+ {
32+ hostname : "api.github.com" ,
33+ path : "/repos/cloudflare/cloudflared/releases" ,
34+ headers : {
35+ "user-agent" : "node-cloudflared" ,
36+ } ,
37+ } ,
38+ ( res ) => {
39+ let data = "" ;
40+ res . on ( "data" , ( chunk ) => {
41+ data += chunk ;
42+ } ) ;
43+ res . on ( "end" , ( ) => {
44+ const releases = JSON . parse ( data ) ;
45+ for ( const release of releases ) {
46+ console . log (
47+ `${ release . tag_name . padEnd ( 10 ) } (${ release . published_at } ) [${
48+ release . html_url
49+ } ]`,
50+ ) ;
51+ }
52+ } ) ;
53+ } ,
54+ ) ;
55+ return ;
56+ }
2857 if ( args [ 1 ] === "help" || args [ 1 ] === "--help" || args [ 1 ] === "-h" ) {
2958 console . log ( `cloudflared bin : Prints the path to the binary` ) ;
3059 console . log ( `cloudflared bin remove : Removes the binary` ) ;
3160 console . log ( `cloudflared bin install [version] : Installs the binary` ) ;
61+ console . log ( `cloudflared bin list : Lists 30 latest releases` ) ;
3262 console . log ( `cloudflared bin help : Prints this help message` ) ;
3363 console . log ( `Examples:` ) ;
3464 console . log (
You can’t perform that action at this time.
0 commit comments