8000 Open Recent project command by artsich · Pull Request #44 · MakovWait/godots · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Open Recent project command #44

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

Merged
merged 2 commits into from
Oct 22, 2023
Merged

Conversation

artsich
Copy link
Contributor
@artsich artsich commented Oct 22, 2023

New Argument for godots

The new argument serves to open the last Godot project.

Usage

godots.exe [--recent or -r]

patched_args.push_back("-e")
as_process(patched_args).create_process()
_ProjectsCache.set_last_opened_project(path)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

	func edit():
		as_process(["-e"]).create_process()
		_ProjectsCache.set_last_opened_project(path)
	func run():
		as_process(["-r"]).create_process()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

func _run_with_editor(item, editor_flag, auto_close):
item.as_process([editor_flag]).create_process()
func _run_with_editor(item: Projects.Item, editor_flag, auto_close):
item.edit([editor_flag])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given: take into account the proposed methods project.edit and project.run
so here we need to call appropriate method based on editor_flag. since editor_flag is a string, we can handle it with if-else

if editor_flag == '-e':
   item.edit()
if editor_flag == '-r':
   item.run()

or use some cool polymorphic stuff

editor_flag.call(item)

where editor flag is Callable with example definition:

func (item): item.edit()
func (item): item.run()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

func _init(user_args: PackedStringArray):
self.user_args = user_args

var _editors: LocalEditors.List
Copy link
8000
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like _editors is unused here

Copy link
Contributor Author
@artsich artsich Oct 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used in execute method to load editors

@MakovWait MakovWait merged commit ce1a8ba into MakovWait:main Oct 22, 2023
@artsich artsich deleted the recent-command branch October 29, 2023 17:20
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.

Consider adding Godots cli argument -recent which is a shorthand for the last path project opened
2 participants
0