Skip to content

Commit

Permalink
Merge branch 'trash'
Browse files Browse the repository at this point in the history
  • Loading branch information
osvik committed Sep 9, 2017
2 parents c4751c4 + 4a15986 commit 921999e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ The filenames describe it's content and running the script again will overwrite

Open this files with your plain/code text editor and investigate the inconsistencies in both your CRM and mailing programs.

#### Delete files created by ecompare

To delete the 3 files created by ecompare:

```
./ecompare -trash
```

## Install

1. Download the [latest version of the binary code](https://github.com/greenpeace/ecompare/releases/) for your operating system to your desktop folder.
Expand Down
8 changes: 6 additions & 2 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ Compare CSV files
Download both files as csvs to the same folder as the script. Then, using the command line run the script as:
./ecompare -data=emails -A=fileA.csv -B=fileB.csv
-data specifies the type of data to compare. It can be emails, sha256 or dni (Spanish ID numbers)
-A and -B specify the names of both files.
Get details about the comparison
Expand Down Expand Up @@ -66,6 +66,10 @@ The filenames describe it's content and running the script again will overwrite
Open this files with your plain/code text editor and investigate the inconsistencies in both your CRM and mailing programs.
To delete the 3 files created by ecompare:
./ecompare -trash
.
*/
package main
3 changes: 3 additions & 0 deletions ecompare.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func main() {
defer timeTrack(time.Now(), "main")

help := flag.Bool("help", false, "Display help")
trash := flag.Bool("trash", false, "Delete files created by ecompare")
data := flag.String("data", "emails", "What to compare")
filenameA := flag.String("A", "a.txt", "File to do the operations")
filenameB := flag.String("B", "b.txt", "File to do the operations")
Expand All @@ -28,6 +29,8 @@ func main() {

if *help == true {
helpMe()
} else if *trash == true {
trashFiles()
} else {

// Read the files to strings
Expand Down
8 changes: 8 additions & 0 deletions functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"io/ioutil"
"log"
"os"
"regexp"
"strings"
"time"
Expand Down Expand Up @@ -80,3 +81,10 @@ func stringToFile(fileName string, dat string) {
panic(err)
}
}

// trashFiles deletes files created by ecompare
func trashFiles() {
os.Remove("in-a-but-not-in-b.txt")
os.Remove("in-b-but-not-in-a.txt")
os.Remove("in-both-a-and-b.txt")
}
1 change: 1 addition & 0 deletions help.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Comand line options:
-A=fileA.csv File A name
-B=fileB.csv File B name
-debug=true Debug the script
-trash To delete the 3 files created by ecompare
`
fmt.Printf(textToPrint)
Expand Down

0 comments on commit 921999e

Please sign in to comment.