Skip to content

Commit

Permalink
fix: unique keys for help output
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Mar 15, 2024
1 parent d8c7112 commit 1b69852
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ Open a repository in github.
```
USAGE
$ multi open REPO [-f <value> | -t actions|discussions|issues|pulls|pulse|security|settings|wiki]
$ multi open REPO [-f <value> | -t
actions|discussions|issues|pulls|pulse|security|settings|wiki]

ARGUMENTS
REPO [default: .] Name of repository.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/components/help.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import {Box, Text} from 'ink'
import crypto from 'node:crypto'
import React from 'react'

function createHash(input: string, index: number): string {
return crypto.createHash('sha256').update(input).digest('hex') + `_${index}`
}

export default function Help({helpOutput}: {readonly helpOutput: string[]}) {
if (helpOutput.length === 0) return
return (
<Box borderColor="green" borderStyle="round" flexDirection="column" padding={2} paddingTop={0}>
{helpOutput.map((s) => (
<Text key={s}>{s}</Text>
{helpOutput.map((s, idx) => (
<Text key={createHash(s, idx)}>{s}</Text>
))}
</Box>
)
Expand Down

0 comments on commit 1b69852

Please sign in to comment.