-
-
Notifications
You must be signed in to change notification settings - Fork 684
feat: editors #4102
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
Closed
Closed
feat: editors #4102
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
aa3b8f3
Add editor cfg
h8d13 8bc0582
Remove from default
h8d13 dfb5a2f
Fix previews
h8d13 3ae9d8d
More codefiles feedback
h8d13 c79b699
special handling only for nvim
h8d13 c6d4b4c
Remove mention
h8d13 96cbbb7
More fb
h8d13 21cb476
More fb
h8d13 066e975
Rem correction for other PR
h8d13 fb68336
Simplify
h8d13 1b8a4f5
Correct pkg name
h8d13 a4c4bb7
Correct later in block
h8d13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| from archinstall.lib.models.application import Editor, EditorConfiguration | ||
| from archinstall.lib.output import debug | ||
|
|
||
| if TYPE_CHECKING: | ||
| from archinstall.lib.installer import Installer | ||
|
|
||
|
|
||
| class EditorApp: | ||
| def _get_editor_binary(self, editor: Editor) -> str: | ||
| # special handling only name that differs | ||
| return 'nvim' if editor == Editor.NEOVIM else editor.value | ||
|
|
||
| def install( | ||
| self, | ||
| install_session: 'Installer', | ||
| editor_config: EditorConfiguration, | ||
| ) -> None: | ||
| debug(f'Installing editor: {editor_config.editor.value}') | ||
|
|
||
| install_session.add_additional_packages([editor_config.editor.value]) | ||
h8d13 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| editor_binary = self._get_editor_binary(editor_config.editor) | ||
| environment_path = install_session.target / 'etc' / 'environment' | ||
|
|
||
| debug(f'Setting EDITOR={editor_binary} in {environment_path}') | ||
|
|
||
| with open(environment_path, 'a') as f: | ||
| f.write(f'EDITOR={editor_binary}\n') | ||
h8d13 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The paradigm used by this repo is to add functionality like this to the enum. Consider following that convention and moving this method to
Editorinstead and removing the underscore(_) that designates it as intending to be private.Here are two instances of this paradigm being used in the repo (there are more):
FilesystemType.installation_pkgarchinstall/archinstall/lib/models/device.py
Lines 814 to 824 in 5fbe1de
GfxDriver.gfx_packagesarchinstall/archinstall/lib/hardware.py
Line 83 in 5fbe1de
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this suggestion can be ignored because you are following the convention set by
archinstall/lib/models/application.pyand other files inarchinstall/applications.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See latest commit ;)