Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit f55f293

Browse files
fix naming & further update README
1 parent 1c8519f commit f55f293

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,34 @@ All of **bak**'s commands will disambiguate between multiple copies of the same
2727
## Additional commands and flags
2828

2929
`bak down --keep my_file` - Restores from .bakfile, does not delete .bakfile
30-
`bak diff my_file` Compare a .bakfile using `diff` (will become configurable)
30+
`bak diff my_file` Compare a .bakfile using `diff` (configurable)
3131
`bak list`/`bak list my_file` - List all .bakfiles, or just `my_file`'s
32-
`bak open my_file` View a .bakfile in $PAGER
32+
`bak open my_file` View a .bakfile in $PAGER (configurable)
3333
`bak open --using exec my_file` View a .bakfile using `exec` (alias `--in`)
3434

35-
examples:
35+
> examples:
3636
3737
bak open --using cat my_file.json
3838
bak open --in nvim my_file.json
3939

4040
`bak get-bak my_file` Get the abspath of a .bakfile, in case, for some reason, you want to pipe it somewhere
4141

42-
example (for illustrative purposes; use 'bak diff' instead):
42+
> example (for illustrative purposes; use 'bak diff' instead):
4343
44-
diff `bak get-bak my_file.json)` my_file.json
44+
diff `bak get-bak my_file.json` my_file.json
4545

4646
## Current state (updated Jan. 20, 2020)
4747
This is a very pre-alpha version, as in, this is a spaghetti proof-of-concept. Perhaps ~~5-6~~ ~~12-15~~ 20 hours have been spent on development so far. As such, it's only "working" in the strictest sense.
4848

4949
At the moment, **bak** stores its database and your bakfiles in `$XDG_DATA_HOME/bak`. If `$XDG_DATA_HOME` is not set, its specified default is used, and your stuff ends up in `~/.local/share/bak`.
5050

51+
The config file exists, but could be more intuitive. It's at `$XDG_CONFIG_HOME/bak.cfg` or `~/.config/bak.cfg` and currently accepts values for:
52+
53+
* The location of your .bakfiles and bakfile DB (I don't recommend changing this)
54+
* The program to use by default for `bak open`
55+
* The program to use by default for `bak diff` (at the moment, this must support typical `diff` syntax, as in `diff <file1> <file2>`)
56+
* Whether `bak list` should display relative paths (defaults to False)
57+
5158
If the above sections suggest that a command is implemented, it's working at the most basic level. There are few sanity checks. Expect and please report bugs, as well as feature requests. If you're brave enough to work on a project in the early, mediocre phase, go nuts with the PRs.
5259

5360
Also, there's ~~no~~ very little exception handling (yet.)

bak/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def bak_diff(filename, using):
111111
required=False,
112112
type=click.Path(exists=True))
113113
def bak_list(relpaths, filename):
114-
commands.show_bak_list(filename=filename or None, relative_paths=relpaths)
114+
commands.open_bak_list(filename=filename or None, relative_paths=relpaths)
115115

116116
if __name__ == "__main__":
117117
bak()

bak/commands/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def get_choice():
121121
choice = get_choice()
122122
continue
123123
elif choice == "l":
124-
show_bak_list(bakfiles[0].orig_abspath)
124+
open_bak_list(bakfiles[0].orig_abspath)
125125
choice = get_choice()
126126
continue
127127
else:
@@ -142,7 +142,7 @@ def get_choice():
142142
get_choice()
143143

144144

145-
def show_bak_list(filename: (None, str, os.path) = None,
145+
def open_bak_list(filename: (None, str, os.path) = None,
146146
relative_paths: bool = False):
147147
""" Prints list of .bakfiles with metadata
148148
@@ -346,7 +346,7 @@ def bak_print_cmd(bak_to_print: (str, bakfile.BakFile),
346346
if not isinstance(bak_to_print, bakfile.BakFile):
347347
return # _get_bakfile_entry() handles failures, so just exit here
348348
pager = using if using else \
349-
(cfg['bak_show_exec'] or os.environ['PAGER']) or 'less'
349+
(cfg['bak_open_exec'] or os.environ['PAGER']) or 'less'
350350
pager = pager.strip('"').strip("'").split(" ")
351351
call(pager + [bak_to_print.bakfile_loc])
352352

bak/default.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ bakfile_location: null # Default: $XDG_DATA_HOME/bak/bakfiles
1111
bak_database_location: null # Default: $XDG_DATA_HOME/bak/bak.db
1212

1313
# Example:
14-
# bak_show_exec: 'less'
14+
# bak_open_exec: 'less'
1515
# (you'll need those single quotes for anything other than null)
16-
bak_show_exec: null # Defaults to $PAGER
16+
bak_open_exec: null # Defaults to $PAGER
1717
bak_diff_exec: null # Defaults to system diff
1818

1919
bak_list_relative_paths: False

0 commit comments

Comments
 (0)