Skip to content
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

[Feature Request] Add the ability to pass in the configuration file from the command line #595

Open
cjappl opened this issue Jun 26, 2024 · 0 comments

Comments

@cjappl
Copy link

cjappl commented Jun 26, 2024

(for the record, I'm more than willing to implement this feature myself and put up a PR, I just want to file this to discuss before putting in the work).

Currently, the config file is hard coded to be the one next to the script:

CONFIG_PATH = os.path.expanduser(
    os.path.join(
        os.path.dirname(os.path.realpath(__file__)),
        "obsidian_to_anki_config.ini"
    )
)

It would be nice to be able to move this file to some other directory, where I could back it up in my own git repository alongside my obsidian notes. I would imagine something like

> python obsidian_to_anki.py -R $OBSIDIAN --regex --config_path=$OBSIDIAN/obsidian_to_anki_data.json

This leads to a few questions, if this feature is desirable

  1. What should the flag and shortname be? (I would expect as a user to use --config and -c, but that would mean moving that existing flag to be --edit-config/-e)
  2. Should we configure the directory that both DATA_PATH and CONFIG_PATH live in? We could do two birds with one stone. This would mean that users can't configure the name of their ini and .json file, which could be desirable
CONFIG_PATH = os.path.expanduser(
    os.path.join(
        os.path.dirname(os.path.realpath(__file__)),
        "obsidian_to_anki_config.ini"
    )
)
...

DATA_PATH = os.path.expanduser(
    os.path.join(
        os.path.dirname(os.path.realpath(__file__)),
        "obsidian_to_anki_data.json"
    )
)
# OBSIDIAN_CONFIG_DIR contains both obsidian_to_anki_config.ini and obsidian_to_anki_data.json
python obsidian_to_anki.py -R $OBSIDIAN_NOTES --regex --config_dir=$OBSIDIAN_CONFIG_DIR
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

No branches or pull requests

1 participant