@@ -36,7 +36,7 @@ export function createNetworkHelpCommand(options = {}) {
3636 const fallbackLines = [
3737 "network.help" ,
3838 "network.replication" ,
39- "network.sample. status"
39+ "network.status"
4040 ] ;
4141
4242 return {
@@ -54,14 +54,14 @@ export function createNetworkHelpCommand(options = {}) {
5454 } ;
5555}
5656
57- function readNetworkSnapshot ( context = { } , sampleKey = "network" ) {
57+ function readNetworkSnapshot ( context = { } , snapshotKey = "network" ) {
5858 const source = asObject ( context ) ;
5959 const assets = asObject ( source . assets ) ;
60- return asObject ( assets [ sampleKey ] ) ;
60+ return asObject ( assets [ snapshotKey ] ) ;
6161}
6262
63- function createReplicationLines ( context = { } , sampleKey = "network" ) {
64- const model = createReplicationDiagnosticsModel ( readNetworkSnapshot ( context , sampleKey ) ) ;
63+ function createReplicationLines ( context = { } , snapshotKey = "network" ) {
64+ const model = createReplicationDiagnosticsModel ( readNetworkSnapshot ( context , snapshotKey ) ) ;
6565 const lines = [
6666 `hostTick=${ model . hostTick } ` ,
6767 `highestBacklog=${ model . highestBacklog } ` ,
@@ -80,10 +80,10 @@ function createReplicationLines(context = {}, sampleKey = "network") {
8080
8181export function createNetworkReplicationCommand ( options = { } ) {
8282 const source = asObject ( options ) ;
83- const sampleKey = sanitizeText ( source . sampleKey ) || "network" ;
83+ const snapshotKey = sanitizeText ( source . snapshotKey ) || "network" ;
8484 const linesFactory = typeof source . createLines === "function"
8585 ? source . createLines
86- : ( context ) => createReplicationLines ( context , sampleKey ) ;
86+ : ( context ) => createReplicationLines ( context , snapshotKey ) ;
8787
8888 return {
8989 name : sanitizeText ( source . name ) || "network.replication" ,
@@ -100,32 +100,32 @@ export function createNetworkReplicationCommand(options = {}) {
100100 } ;
101101}
102102
103- export function createNetworkSampleCommand ( options = { } ) {
103+ export function createNetworkStatusCommand ( options = { } ) {
104104 const source = asObject ( options ) ;
105- const sampleCommandId = sanitizeText ( source . sampleCommandId ) || "status" ;
106- const commandName = sanitizeText ( source . name ) || `network.sample .${ sampleCommandId } ` ;
107- const sampleKey = sanitizeText ( source . sampleKey ) || "network" ;
105+ const commandId = sanitizeText ( source . commandId ) || "status" ;
106+ const commandName = sanitizeText ( source . name ) || ( commandId === "status" ? "network.status" : `network.status .${ commandId } ` ) ;
107+ const snapshotKey = sanitizeText ( source . snapshotKey ) || "network" ;
108108 const linesFactory = typeof source . createLines === "function"
109109 ? source . createLines
110110 : ( context = { } ) => {
111- const snapshot = readNetworkSnapshot ( context , sampleKey ) ;
111+ const snapshot = readNetworkSnapshot ( context , snapshotKey ) ;
112112 const keys = Object . keys ( snapshot ) ;
113113 return [
114- `sampleKey =${ sampleKey } ` ,
114+ `snapshotKey =${ snapshotKey } ` ,
115115 `fields=${ keys . length > 0 ? keys . join ( "," ) : "none" } `
116116 ] ;
117117 } ;
118118
119119 return {
120120 name : commandName ,
121- summary : sanitizeText ( source . summary ) || "Show sample-specific network diagnostics." ,
121+ summary : sanitizeText ( source . summary ) || "Show network diagnostics for the selected snapshot key ." ,
122122 usage : sanitizeText ( source . usage ) || commandName ,
123123 handler ( context = { } , args = [ ] ) {
124124 return {
125125 status : "ready" ,
126- title : sanitizeText ( source . title ) || "Network Sample Diagnostics" ,
126+ title : sanitizeText ( source . title ) || "Network Diagnostics" ,
127127 lines : asArray ( linesFactory ( context , asArray ( args ) ) ) . map ( ( line ) => String ( line ) ) ,
128- code : sanitizeText ( source . code ) || "NETWORK_SAMPLE "
128+ code : sanitizeText ( source . code ) || "NETWORK_STATUS "
129129 } ;
130130 }
131131 } ;
0 commit comments