Skip to content

Commit 84eb594

Browse files
committed
concat.sh
1 parent 21954a6 commit 84eb594

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ set(COMPILE_WARNING_AS_ERROR 1)
88
add_executable(${PROJECT_NAME} ${SRCS})
99

1010
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
11+
install(PROGRAMS tools/concat.sh DESTINATION bin)
1112

1213
# separate sha256 for windows, because both stdout shell redirect
1314
# and piping stdout onward are in _TEXT

tools/concat.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
rm -f .concat.tmp
4+
5+
while [ ! -z "$1" ] ; do
6+
7+
if [ ! -e "$1" ] ; then
8+
echo "ABORTING: unable to find $1 - is cwd correct?"
9+
exit 1
10+
fi
11+
12+
echo >> .concat.tmp
13+
echo >> .concat.tmp
14+
echo "$1:" >> .concat.tmp
15+
echo >> .concat.tmp
16+
echo '```' >> .concat.tmp
17+
cat $1 >> .concat.tmp
18+
echo '```' >> .concat.tmp
19+
20+
shift 1
21+
done
22+
23+
which xsel
24+
if [ $? -ne 0 ] ; then
25+
echo "xsel not available, dumping to stdout =============================================="
26+
cat .concat.tmp
27+
exit 0
28+
fi
29+
cat .concat.tmp | xsel
30+
31+
echo "Concatenated file contents in clipboard"
32+
33+
exit 0

0 commit comments

Comments
 (0)