Skip to content

Commit

Permalink
Allow the # character in directory paths and tag names
Browse files Browse the repository at this point in the history
  • Loading branch information
joowani committed Aug 23, 2016
1 parent 4540555 commit 5f7ca6f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions dtags/chars.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', '_', '-'
'8', '9', '_', '-', '#'
}
# Allowed characters in directory paths
PATH_CHARS = {
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', '-', '_', '.', '/', '~', ' '
'8', '9', '-', '_', '.', '/', '~', ' ', '#'
}


Expand Down
22 changes: 11 additions & 11 deletions dtags/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,16 @@ def refresh():
if config is None:
abort('dtags: unsupported shell: ' + style.bad(shell_path))

assign_string = 'set -g {} "{}"' if shell_name == 'fish' else '{}="{}"'
declare_str = 'set -g {} "{}"' if shell_name == 'fish' else '{}="{}"'
mapping, _ = load_mapping()
print('\n'.join(
assign_string.format(tag.replace('-', '_'), paths.pop())
for tag, paths in mapping.items()
if len(paths) == 1 and
tag.replace('-', '_') not in os.environ and
not get_invalid_tag_chars(tag)
))




declarations = []
for tag, paths in mapping.items():
cleaned_tag = tag.replace('-', '_').replace('#', '_')
if (
cleaned_tag not in os.environ and
not get_invalid_tag_chars(tag) and
len(paths) == 1
):
declarations.append(declare_str.format(cleaned_tag, paths.pop()))
print('\n'.join(declarations))
2 changes: 1 addition & 1 deletion dtags/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '3.1.2'
VERSION = '3.2.0'

0 comments on commit 5f7ca6f

Please sign in to comment.