deadc0de6 / dotdrop

Save your dotfiles once, deploy them everywhere
https://dotdrop.readthedocs.io
GNU General Public License v3.0
1.79k stars 105 forks source link

[bug] TypeError: Dotfile.__init__() got an unexpected keyword argument 'impignore' #358

Closed rino0601 closed 2 years ago

rino0601 commented 2 years ago

Dotdrop version (and git commit if run from source): v1.10.3 Using dotdrop: homebrew

Describe the bug Cursor_및_Config_file_-_dotdrop

image

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a dotfile with content impignore
  2. dotdrop compare
  3. See error

Expected behavior

I checked the contents of dotdrop/dotfile.py, and it seems that only that part of the document needs to be deleted.

Additional information

The relevant part of the config file

dotfiles:
  d_config:
    src: config
    dst: ~/.config
    chmod: '700'
    instignore: [ 'jgit' ]
    impignore: [ 'jgit' ]  # err!
    cmpignore: [ 'jgit' ]
    upignore: [ 'jgit' ]

Dotdrop's execution with the debug logs (--verbose)

➜  dotfiles git:(main) ✗ dotdrop compare                   
Traceback (most recent call last):
  File "/opt/homebrew/bin/dotdrop", line 33, in <module>
    sys.exit(load_entry_point('dotdrop==1.10.3', 'console_scripts', 'dotdrop')())
  File "/opt/homebrew/Cellar/dotdrop/1.10.3/libexec/lib/python3.10/site-packages/dotdrop/__init__.py", line 13, in main
    if dotdrop.dotdrop.main():
  File "/opt/homebrew/Cellar/dotdrop/1.10.3/libexec/lib/python3.10/site-packages/dotdrop/dotdrop.py", line 872, in main
    opts = Options()
  File "/opt/homebrew/Cellar/dotdrop/1.10.3/libexec/lib/python3.10/site-packages/dotdrop/options.py", line 171, in __init__
    self._read_config()
  File "/opt/homebrew/Cellar/dotdrop/1.10.3/libexec/lib/python3.10/site-packages/dotdrop/options.py", line 256, in _read_config
    self.conf = Cfg(self.confpath, self.profile, debug=self.debug,
  File "/opt/homebrew/Cellar/dotdrop/1.10.3/libexec/lib/python3.10/site-packages/dotdrop/cfg_aggregator.py", line 44, in __init__
    self._load()
  File "/opt/homebrew/Cellar/dotdrop/1.10.3/libexec/lib/python3.10/site-packages/dotdrop/cfg_aggregator.py", line 260, in _load
    self.dotfiles = Dotfile.parse_dict(self.cfgyaml.dotfiles)
  File "/opt/homebrew/Cellar/dotdrop/1.10.3/libexec/lib/python3.10/site-packages/dotdrop/dictparser.py", line 39, in parse_dict
    return [cls.parse(k, v) for k, v in items.items()]
  File "/opt/homebrew/Cellar/dotdrop/1.10.3/libexec/lib/python3.10/site-packages/dotdrop/dictparser.py", line 39, in <listcomp>
    return [cls.parse(k, v) for k, v in items.items()]
  File "/opt/homebrew/Cellar/dotdrop/1.10.3/libexec/lib/python3.10/site-packages/dotdrop/dictparser.py", line 32, in parse
    return cls(key=key, **newv)
TypeError: Dotfile.__init__() got an unexpected keyword argument 'impignore'

(The verbose option is omitted because it is too verbose. But it will be enough.)

deadc0de6 commented 2 years ago

impignore is a config block entry and not a dotfiles entry:

The point is that if the dotfile entry is already there, then it makes little sense to have an ignore pattern on import. Maybe you were looking for upignore?

deadc0de6 commented 2 years ago

@rino0601 I have cleaned the error so that it's less verbose. It will be available in the next release.

rino0601 commented 2 years ago

@deadc0de6 Sorry for the late reply. And thanks for the great tool.

I'm new to this tool, and I found this while trying to learn something. (After reading only "getting started" and skipping the rest)

If I had followed all the "usage" documentation, I would have known that import and update exist separately, so I would not have tried to import the imported one again, so I would not have noticed this awkwardness.

I thought the documentation was awkward, so I tried to write a PR. The content to be written was small, but I had to understand the repo structure to write mkdocs , so my reply was delayed because I was wasting time here.

In doing so, I came to understand the code and functions of the project, and as my understanding improved, the documentation did not look awkward at all. It makes sense.

In the end, it was because I did not read the documents in order, and it was difficult to explain to people who did not see the explanation, so I decided that it was not something to fix by fixing the document.

My misunderstanding has been cleared up, so I guess I'll just have to close it. Sorry to bother you!

And once again thank you for this project.

deadc0de6 commented 2 years ago

@rino0601 no problem, happy to help!

Could you provide me with more information on why you didn't find your way in the doc at the beginning so that I can improve it?

Thanks for your help!

rino0601 commented 2 years ago

Config_file_-_dotdrop