Skip to content

Commit

Permalink
cli: include the network alias in indexer rules delete messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tilacog committed Jun 20, 2023
1 parent cf47b68 commit b6c23d0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/indexer-cli/src/commands/indexer/rules/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
parseOutputFormat,
} from '../../../command-helpers'
import { indexingRules, deleteIndexingRules } from '../../../rules'
import { processIdentifier } from '@graphprotocol/indexer-common'
import { processIdentifier, resolveChainAlias } from '@graphprotocol/indexer-common'

const HELP = `
${chalk.bold('graph indexer rules delete')} [options] all
Expand Down Expand Up @@ -45,6 +45,7 @@ module.exports = {

try {
const protocolNetwork = requireProtocolNetworkOption(parameters.options)
const chainAlias = resolveChainAlias(protocolNetwork)
const [identifier, identifierType] = await processIdentifier(id, {
all: true,
global: true,
Expand All @@ -70,11 +71,13 @@ module.exports = {
/* eslint-disable @typescript-eslint/no-non-null-assertion */
await deleteIndexingRules(client, rulesIdentifiers)
/* eslint-enable @typescript-eslint/no-non-null-assertion */
print.success(`Deleted all indexing rules`)
print.success(`Deleted all indexing rules for network '${chainAlias}'`)
} else if (identifier === 'global') {
const globalIdentifier = { identifier, protocolNetwork }
await deleteIndexingRules(client, [globalIdentifier])
print.warning(`Reset global indexing rules (the global rules cannot be deleted)`)
print.warning(
`Reset global indexing rules for network '${chainAlias}' (global rules cannot be deleted)`,
)
} else {
const ruleIdentifier = { identifier, protocolNetwork }
await deleteIndexingRules(client, [ruleIdentifier])
Expand Down

0 comments on commit b6c23d0

Please sign in to comment.