Skip to content

Allow dots and slashes in tags #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mhils
Copy link

@mhils mhils commented Feb 21, 2018

Hi! First off, thanks for the fantastic work here @nomeata. 😊

I stumbled upon arbtt earlier today and started working on an initial configuration. One thing I tried was creating tags for particular websites. Capturing this works great with a Chrome addon, but the output of arbtt-stats isn't as beautiful as it maybe could be:

$ arbtt-stats -c "web"
Statistics for category "web"
=============================
_________________Tag______|______Time_|_Percentage_
web:arbtt_nomeata_de_doc_ |     7m00s |      10.14
         (unmatched time) |  1h02m00s |      89.86

I feel that it would be much nicer to have this:

$ arbtt-stats -c "web"
Statistics for category "web"
=============================
_________________Tag______|______Time_|_Percentage_
web:arbtt.nomeata.de/doc/ |     7m00s |      10.14
         (unmatched time) |  1h02m00s |      89.86

The same issue occurs for folders, where / and \ are replaced with underscores as well (Program_Files__x86__Google_Chrome_Application_chrome_exe).

This PR makes replaceForbidden a bit more lax by allowing ., /, and \. As \ is a bit problematic as an escape character, I decided to replace it with a forward slash. While maybe not ideal, it makes Windows paths much nicer. Maybe it's also nice to allow parantheses, but I wanted to keep it minimal for now and only include the characters I would care about.

Thanks!
Max

A backslash may cause problems in some contexts, so we print it as a forward slash instead. This makes paths on Windows more readable.
@nomeata
Copy link
Owner

nomeata commented Feb 21, 2018

I wonder why I disallowed strange characters in the first place. Maybe I should just allow them all!

For consistency, that would probably call for the syntax

tag "foo:bar"

i.e. quotes when an explicitly written tag has special characters.

@mhils
Copy link
Author

mhils commented Feb 21, 2018

FWIW, arbtt-dump crashes on "Skype™ - username" on Windows, so maybe that is why:

PS > arbtt-dump.exe
2018-02-20 20:53:36 (688ms inactive):
    ( ) \Device\HarddiskVolume4\Windows\explorer.exe: Program Manager
    ( ) \Device\HarddiskVolume4\Program Files (x86)\Google\Drive\googledrivesync.exe: Backup & Sync
    ( ) \Device\HarddiskVolume4\Program Files\WindowsApps\Microsoft.WindowsStore_11801.1001.6.0_x64__8wekyb3d8bbwe\WinStore.App.exe: Microsoft Store
    ( ) \Device\HarddiskVolume4\Windows\System32\ApplicationFrameHost.exe: Microsoft Store
    ( ) \Device\HarddiskVolume4\Program Files (x86)\Skype\Phone\Skype.exe: Skypearbtt-dump.exe: <stdout>: commitBuffer: invalid argument (invalid character)

But yes - happy to do any changes that can be done with my nonexistent Haskell knowledge. :-)

@nomeata nomeata force-pushed the master branch 3 times, most recently from 36a85b3 to 64d7f25 Compare May 11, 2020 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants