Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 12, 2021
1 parent 5b2c680 commit 04d29c6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions src/combination/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ import { getCombinationIds } from './ids.js'
// report time
// - `combinationName` uses ids, which is more useful at `run`-time
// (`dev`, preview bottom bar) since users might use those on the next run
export const getCombinationName = function (combination) {
export const getCombinationNameColor = function (combination) {
return getCombinationIds(combination)
.map(getCombinationNamePart)
.join(noteColor(', '))
.join(NAME_SEPARATOR_COLOR)
}

const getCombinationNamePart = function ({ dimension: { messageName }, id }) {
return `${noteColor(messageName)} ${QUOTE}${titleColor(id)}${QUOTE}`
const idColor = titleColor(id)
return `${noteColor(messageName)} ${QUOTE_COLOR}${idColor}${QUOTE_COLOR}`
}

const QUOTE = noteColor('"')
const NAME_SEPARATOR_COLOR = noteColor(', ')
const QUOTE_COLOR = noteColor('"')
6 changes: 3 additions & 3 deletions src/dev/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCombinationName } from '../combination/name.js'
import { getCombinationNameColor } from '../combination/name.js'
import { measureCombinations } from '../run/measure/main.js'

// Execute tasks without benchmarking them.
Expand All @@ -25,7 +25,7 @@ export const combinationDev = async function (combination, { cwd }) {
// Print the ids of each combination before running them, so users can
// visually separate their output
const printCombinationName = function (combination) {
const combinationName = getCombinationName(combination)
const combinationNameColor = getCombinationNameColor(combination)
// eslint-disable-next-line no-restricted-globals, no-console
console.log(combinationName)
console.log(combinationNameColor)
}
4 changes: 2 additions & 2 deletions src/run/preview/combination.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import now from 'precise-now'

import { getCombinationName } from '../../combination/name.js'
import { getCombinationNameColor } from '../../combination/name.js'

import { START_DESCRIPTION } from './description.js'
import { updatePreview } from './update/main.js'
Expand All @@ -15,7 +15,7 @@ export const startCombinationPreview = async function (
return
}

const combinationName = getCombinationName(combination)
const combinationName = getCombinationNameColor(combination)
// eslint-disable-next-line fp/no-mutating-assign
Object.assign(previewState, {
combinationStart: now(),
Expand Down

0 comments on commit 04d29c6

Please sign in to comment.