damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 02f1c2d342c3b786489f25495ae746cc268cb604
parent c8ca3c93f6ebf82da0a4bae088e51773f97f8c50
Author: Daniel D’Aquino <daniel@daquino.me>
Date:   Wed, 20 Nov 2024 11:50:45 -0800

Add script to help identify duplicate changelog entries

This commit adds a new script to devtools that can be used to help
identify duplicate changelog entries.

It works by identifying duplicate lines in CHANGELOG.md, and then
searching whether each one of those duplicate lines are present in a
separate text file (which can be a subset of the changelog that the user
is interested in analyzing)

No user-facing changes

Changelog-None
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>

Diffstat:
Adevtools/find-changelog-duplicates.sh | 42++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+), 0 deletions(-)

diff --git a/devtools/find-changelog-duplicates.sh b/devtools/find-changelog-duplicates.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Usage function to display help +function usage() { + echo "Usage: $0 <file1> <file2>" + echo "Where:" + echo " <file1> is the file to find duplicates within" + echo " <file2> is the file to check these duplicates against" + echo + echo "This script finds duplicate lines in <file1> and prints out any" + echo "of these duplicates that exist in <file2>." + exit 1 +} + +# Check for help flag +if [[ "$1" == "-h" || "$1" == "--help" ]]; then + usage +fi + +# Check the number of arguments provided +if [ "$#" -ne 2 ]; then + echo "Error: Two arguments are required." + usage +fi + +# Assign arguments to variables +file1=$1 +file2=$2 + +# Check if files exist +if [ ! -f "$file1" ]; then + echo "Error: File '$file1' does not exist." + exit 1 +fi + +if [ ! -f "$file2" ]; then + echo "Error: File '$file2' does not exist." + exit 1 +fi + +# Find duplicates and check against the second file +sort "$file1" | uniq -d | grep -Fxf - "$file2"