Skip to content

Commit

Permalink
refactor: mv relate subcmd to explore-data
Browse files Browse the repository at this point in the history
Their UI is similar enough now that it makes sense to put them under the
same subcommand. Also do some source code organizing in a loose attempt
to isolate the CLI rendering things. Update docs.
This is a breaking change, but I'm the only user I know about.
  • Loading branch information
rafaelespinoza committed Jan 8, 2024
1 parent 885f40c commit 3f8e311
Show file tree
Hide file tree
Showing 10 changed files with 474 additions and 509 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ $ bin/main draw -output-format=mermaid < testdata/simpsons.ged > /tmp/ged/simpso
$ bin/main draw -input-format=mermaid < /tmp/ged/simpsons.mermaid > /tmp/ged/simpsons.svg
```

### relate
### explore-data

#### relate

Calculate relationship between 2 people.

Expand All @@ -105,5 +107,19 @@ $ ./explore-data.sh relate testdata/kennedy.ged

If you don't have fzf or don't want to use it, specify the IDs of the people like so:
```sh
$ bin/main relate -p1 @I0@ -p2 @I10@ < testdata/kennedy.ged
$ bin/main explore-data relate -p1 @I0@ -p2 @I10@ < testdata/kennedy.ged
```

#### show

Display details on a person in a simple group sheet view.

If you have [fzf](https://github.com/junegunn/fzf) on your system, then use fuzzy search to select the people.
```sh
$ ./explore-data.sh show testdata/kennedy.ged
```

If you don't have fzf or don't want to use it, specify the ID of the person like so:
```sh
$ bin/main explore-data show -target-id @I10@ < testdata/kennedy.ged
```
4 changes: 2 additions & 2 deletions explore-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function relate() {
echo "${err_no_fzf}
Example:
$ bin/main relate -p1 @I0@ -p2 @I10@ < testdata/kennedy.ged" | fold -s >&2
$ bin/main explore-data relate -p1 @I0@ -p2 @I10@ < testdata/kennedy.ged" | fold -s >&2
return 1
fi

Expand Down Expand Up @@ -90,7 +90,7 @@ $ bin/main relate -p1 @I0@ -p2 @I10@ < testdata/kennedy.ged" | fold -s >&2
local -r fzf_on_enter='
p1=$(echo {+1} | awk "{ print \$1 }")
p2=$(echo {+1} | awk "{ print \$2 }")
${GED_BIN:?missing GED_BIN} -q relate -p1 "${p1}" -p2 "${p2}" <"${INFILE:?missing INFILE}"'
${GED_BIN:?missing GED_BIN} -q explore-data relate -p1 "${p1}" -p2 "${p2}" <"${INFILE:?missing INFILE}"'

_run_ged parse to-lines < "${infile}" | _run_fzf \
--header='Pick 2 people to compare. Press TAB to select/unselect. Press Enter when ready.' \
Expand Down
1 change: 0 additions & 1 deletion internal/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func New() Root {
Subs: map[string]alf.Directive{
"draw": makeDraw("draw"),
"parse": makeParse("parse"),
"relate": makeRelate("relate"),
"explore-data": makeExploreData("explore-data"),
},
}
Expand Down

0 comments on commit 3f8e311

Please sign in to comment.