@@ -14,19 +14,21 @@ import {
1414import { sshReq } from "../utils.js" ;
1515import { repo_create } from "./repo.js" ;
1616import { isDryrun } from "../dryrun.js" ;
17+ import { outputGit } from "../printUtils.js" ;
18+ import { SERVICE_GROUP } from "../config.js" ;
1719
1820export async function do_deleteServiceGroup (
1921 serviceGroup : ServiceGroup ,
2022 displayName : string
2123) {
2224 if ( isDryrun ( ) ) {
23- output ( " DRYRUN: Would delete service group" ) ;
25+ output ( ` DRYRUN: Would delete ${ SERVICE_GROUP } ` ) ;
2426 return ;
2527 }
2628 try {
27- console . log ( `Deleting service group '${ displayName } '...` ) ;
29+ outputGit ( `Deleting ${ SERVICE_GROUP } '${ displayName } '...` ) ;
2830 const reply = await sshReq ( `group-delete` , serviceGroup . id . toString ( ) ) ;
29- console . log ( reply ) ;
31+ outputGit ( reply ) ;
3032 if ( existsSync ( serviceGroup . pathTo . toString ( ) ) )
3133 await rename (
3234 serviceGroup . pathTo . toString ( ) ,
@@ -54,7 +56,7 @@ export async function deleteServiceGroup(organization: Organization) {
5456 const folderName = Str . toFolderName ( group . name ) ;
5557 return {
5658 long : folderName ,
57- text : `Delete ${ group . name } ( ${ folderName } ) ` ,
59+ text : `Delete ${ SERVICE_GROUP } ${ group . name } permanently ` ,
5860 action : ( ) =>
5961 deleteServiceGroupId (
6062 {
@@ -67,7 +69,7 @@ export async function deleteServiceGroup(organization: Organization) {
6769 } ) ;
6870 return {
6971 options,
70- header : " Which service group would you like to delete?" ,
72+ header : ` Which ${ SERVICE_GROUP } would you like to delete?` ,
7173 } ;
7274 } ) . then ( ) ;
7375 } catch ( e ) {
@@ -81,11 +83,11 @@ export async function do_createServiceGroup(
8183 displayName : string
8284) {
8385 if ( isDryrun ( ) ) {
84- output ( " DRYRUN: Would create service group" ) ;
86+ output ( ` DRYRUN: Would create ${ SERVICE_GROUP } ` ) ;
8587 return new ServiceGroupId ( "dryrun_id" ) ;
8688 }
8789 try {
88- console . log ( `Creating service group '${ displayName } '...` ) ;
90+ outputGit ( `Creating ${ SERVICE_GROUP } '${ displayName } '...` ) ;
8991 const reply = await sshReq (
9092 `group-create` ,
9193 displayName ,
@@ -114,7 +116,7 @@ export async function group_new(organization: Organization) {
114116 )
115117 num ++ ;
116118 const displayName = await shortText (
117- "Service group name" ,
119+ ` ${ SERVICE_GROUP [ 0 ] . toUpperCase ( ) + SERVICE_GROUP . substring ( 1 ) } name` ,
118120 "Used to share envvars." ,
119121 "service-group-" + num
120122 ) . then ( ) ;
@@ -140,11 +142,11 @@ export async function do_renameServiceGroup(
140142 newDisplayName : string
141143) {
142144 if ( isDryrun ( ) ) {
143- output ( " DRYRUN: Would rename service group" ) ;
145+ output ( ` DRYRUN: Would rename ${ SERVICE_GROUP } ` ) ;
144146 return ;
145147 }
146148 try {
147- console . log ( `Renaming service group to '${ newDisplayName } '...` ) ;
149+ outputGit ( `Renaming ${ SERVICE_GROUP } to '${ newDisplayName } '...` ) ;
148150 const reply = await sshReq (
149151 `group-modify` ,
150152 `--displayName` ,
@@ -168,7 +170,7 @@ async function group_edit_rename(
168170) {
169171 try {
170172 const newDisplayName = await shortText (
171- "Service group name" ,
173+ ` ${ SERVICE_GROUP [ 0 ] . toUpperCase ( ) + SERVICE_GROUP . substring ( 1 ) } name` ,
172174 "Used to share envvars." ,
173175 oldDisplayName
174176 ) . then ( ) ;
@@ -195,7 +197,7 @@ async function group_edit(serviceGroup: ServiceGroup, displayName: string) {
195197 [
196198 {
197199 long : "rename" ,
198- text : `rename it ` ,
200+ text : `rename ${ SERVICE_GROUP } ` ,
199201 action : ( ) =>
200202 group_edit_rename (
201203 serviceGroup . pathTo ,
@@ -205,14 +207,14 @@ async function group_edit(serviceGroup: ServiceGroup, displayName: string) {
205207 } ,
206208 {
207209 long : "delete" ,
208- text : `delete it permanently` ,
210+ text : `delete ${ SERVICE_GROUP } ' ${ displayName } ' permanently` ,
209211 action : ( ) => deleteServiceGroupId ( serviceGroup , displayName ) ,
210212 } ,
211213 ] ,
212214 async ( ) => {
213215 return {
214216 options : [ ] ,
215- header : `How would you like to edit ' ${ displayName } ' ?` ,
217+ header : `How would you like to edit the ${ SERVICE_GROUP } ?` ,
216218 } ;
217219 }
218220 ) . then ( ( x ) => x ) ;
@@ -227,7 +229,7 @@ export async function group(organization: Organization) {
227229 {
228230 long : "new" ,
229231 short : "n" ,
230- text : `create new service group ` ,
232+ text : `create a new ${ SERVICE_GROUP } ` ,
231233 action : ( ) => group_new ( organization ) ,
232234 } ,
233235 ] ,
@@ -255,7 +257,7 @@ export async function group(organization: Organization) {
255257 } ) ;
256258 return {
257259 options,
258- header : " Which service group would you like to manage?" ,
260+ header : ` Which ${ SERVICE_GROUP } would you like to manage?` ,
259261 } ;
260262 }
261263 ) . then ( ) ;
0 commit comments