-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpseudolc
More file actions
executable file
·27 lines (22 loc) · 973 Bytes
/
pseudolc
File metadata and controls
executable file
·27 lines (22 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
## -------------------------------------------------------------------
## Pseudo Working-Line Counter 1.0.0
##
## This is free software: you are free to change and redistribute it.
## There is NO WARRANTY, to the extent permitted by law.
## -------------------------------------------------------------------
### Counts how many lines actually do anything in code.
### Works on any language in which an empty line or one containing only curly braces can be considered "non-working".
### Usage: pseudolc [options] <file>...
###
### -h, --help Show help options.
### -v, --version Print program version.
help=$(grep "^### " "$0" | cut -c 5-)
version=$(grep "^## " "$0" | cut -c 4-)
eval "$(docopts -A args -h "$help" -V "$version" : "$@")"
FILES=""
for (( i = 0; i < ${args[<file>,#]}; i++ )); do
FILES="$FILES ${args[<file>,$i]}"
done
cat $FILES | sed -nf $(dirname $0)/removeComments.sed | sed -r "/^\s*\{*\}*\s*$/d" | wc -l
exit 0