Skip to content

Add godots cli open command.#28

Closed
artsich wants to merge 1 commit intoMakovWait:mainfrom
artsich:main
Closed

Add godots cli open command.#28
artsich wants to merge 1 commit intoMakovWait:mainfrom
artsich:main

Conversation

@artsich
Copy link
Copy Markdown
Contributor

@artsich artsich commented Oct 10, 2023

Example of usage
Godots.exe --headless -open=4.1.1 -- --path "C:/Users/cli-godot-example" "C:/cli-godot-example/main.tscn" -- -game_arg true

  • Mac OS support

@artsich artsich force-pushed the main branch 2 times, most recently from 64b8243 to 42e8052 Compare October 10, 2023 21:37
Comment thread src/main/cli_main.gd Outdated

if (parsed_args.size() >= 1):
if "open" in parsed_args:
pass
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

🤔

Comment thread src/main/main.gd Outdated
_exit()
else:
print("Run window mode")
add_child.call_deferred(windowMainScene.instantiate())
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

seems like we don't need to preload it

add_child.call_deferred(load("res://src/main/window_main.tscn").instantiate())

and remove line::3

const windowMainScene: PackedScene = preload("res://src/main/window_main.tscn")

Comment thread src/services/local_editors.gd Outdated
for e in all():
if (e.name.contains(name)):
return e;
return null;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

remove ;

Comment thread src/services/local_editors.gd Outdated
func retrieve_by_name_pattern(name: String) -> LocalEditor:
for e in all():
if (e.name.contains(name)):
return e;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

;

Comment thread src/services/local_editors.gd Outdated

func retrieve_by_name_pattern(name: String) -> LocalEditor:
for e in all():
if (e.name.contains(name)):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

e.name.findn(name) > -1

should be better

Comment thread src/services/local_editors.gd Outdated
tags_edited.emit()

func open(args: PackedStringArray):
print("Run editor with arguments: ", args)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

use

Output.push("Run editor with arguments: %s" % args)

@artsich artsich marked this pull request as draft October 11, 2023 08:39
@artsich artsich changed the title WIP: Add godots cli open command. Add godots cli open command. Oct 11, 2023
@artsich artsich force-pushed the main branch 2 times, most recently from da0f241 to 3795cab Compare October 11, 2023 11:10
@artsich artsich marked this pull request as ready for review October 11, 2023 11:12
Comment thread src/services/local_editors.gd Outdated

const dir = preload("res://src/extensions/dir.gd")

const mac_os_editor_path_postfix = "/Contents/MacOS/Godot"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

	var mac_os_editor_path_postfix:
		get: return _section.get_value("mac_os_editor_path_postfix", "/Contents/MacOS/Godot")

Comment thread src/services/local_editors.gd Outdated
var pid = OS.create_process(process_args.path, process_args.args)

if (pid == -1):
Output.push('An array occured when create editor process')
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

'An array...' looks like a typo

@SeremTitus
Copy link
Copy Markdown
Contributor

@JillyMan, can you consider adding Godots cli argument -recent which is a shorthand for the last path project opened
such that something like Godots.exe -recent will open the last project opened using Godots.

Am not sure this proposal is in the scope of your commit ,however, any response will be appreciated

@artsich
Copy link
Copy Markdown
Contributor Author

artsich commented Oct 15, 2023

@JillyMan, can you consider adding Godots cli argument -recent which is a shorthand for the last path project opened such that something like Godots.exe -recent will open the last project opened using Godots.

Am not sure this proposal is in the scope of your commit ,however, any response will be appreciated

Hi @SeremTitus I'm fine with this cli argument. Will do it in separate PR.

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.

3 participants