asimov icon indicating copy to clipboard operation
asimov copied to clipboard

Using a file for asimov options

Open muuvmuuv opened this issue 5 years ago • 7 comments

I think it would be a great thing to actually have a place to store options that are suggested in other issues: We could do something like: ~/.asimovrc which contains options per line like .bashrc or in a JSON format.

muuvmuuv avatar Oct 09 '18 07:10 muuvmuuv

Jotting down some ideas around this, maybe something like ~/.asimov.json:

{
    // The directories that should be scanned.
    "directories": [
        "~/Code",
        "~/Sites",
        "~/Vagrant",
    ],

    // Directories that might match but should be ignored
    // https://github.com/stevegrunwell/asimov/issues/14
    "ignore": [
        "~/.atom/extensions",
        "~/.vscode/extensions",
    ],

    // Additional patterns that aren't already covered in Asimov core.
    "additionalPatterns": {
        "build.sh": ["dist"],
    },
}

This would be painful to pull off with the current Bash iteration, but if we're rewriting Asimov in another language that opens the door to easily reading the JSON and merging it with default settings.

Of course, documentation around the available options here would be key 😄

stevegrunwell avatar Jun 08 '20 03:06 stevegrunwell

I would more likely put it into ~/.config/asimov/{directories,ignore,options.json} now. IMO, libs should stop creating files in the users root. Plus this would allow a more generic configuration thus files like ignore and directory are more self-explanatory and could use pattern-per-line syntax.

Read more here about the config directory:

  • https://stackoverflow.com/a/1024216/4628787
  • https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

muuvmuuv avatar Jun 08 '20 06:06 muuvmuuv

I would love to have this in!

pkuczynski avatar Apr 03 '21 21:04 pkuczynski

Hi everyone,

My two cents on this. Using a ~/.asimovrc file is a good idea. Could also be in a per project .asimovrc. But wait!

As developers, I do not know about you, but I do use git a lot. Could I be possible to use .gitignore file if present?

Maybe, compare it with known .gitignore patterns to remove OS specific ignore rules so the backup wont mess those.

Projects may use git but not be on a remote repository so backing them up is the way to go anyway.

MichelCPU avatar Sep 17 '21 20:09 MichelCPU

Parsing .gitignore is IMO far too much, some can have many lines and this would add so many entries in TM that I would expect it to get slower over time. And keep in mind that TM does not support Regex, so Asimov would need to parse each regex for matching patterns, which makes it slow.

Since it is macOS only, I, personally, wouldn't like a .asmimovrc file in any of my projects.

muuvmuuv avatar Sep 20 '21 11:09 muuvmuuv

I see the appeal of reading from the .gitignore file, but that file has a very specific purpose that doesn't totally align with the goals of Asimov.

For a good example, consider an .env file: this file should absolutely be present in a .gitignore file (to prevent leaking sensitive information), but is one of the few parts of a project that would be a pain to re-create in the event of a Time Machine restore operation.

stevegrunwell avatar Sep 20 '21 14:09 stevegrunwell

You are right. I didn't went far enough in my reflection about this.

MichelCPU avatar Sep 20 '21 14:09 MichelCPU