Skip to content

vim-style +args#767

Merged
lethosor merged 1 commit intoDFHack:developfrom
BenLubar:benlubar-init-args
Dec 26, 2015
Merged

vim-style +args#767
lethosor merged 1 commit intoDFHack:developfrom
BenLubar:benlubar-init-args

Conversation

@BenLubar
Copy link
Copy Markdown
Member

For example, ./dfhack +echo foo would be equivalent to running ./dfhack and then typing echo foo into the console. uses shell argument splitting, so ./dfhack +somecommand "foo bar" baz does the right thing.

See #755.

@expwnent
Copy link
Copy Markdown
Member

What's wrong with putting it in dfhack.init?

@BenLubar
Copy link
Copy Markdown
Member Author

It's easier to run a command once by putting it on the command line than it is to edit dfhack.init and then start the game and edit dfhack.init again. vim has .vimrc and +foo for the same reason.

The other part of #755 is that a plugin would have to define a load region1 command, and then you could run ./dfhack +load region1 to skip the entire menu system and go straight to the loading screen for the world. Something like that would generally be a one-time use, not something you'd want to run every time you started the game.

library/Core.cpp Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should check for the global being non-null (and the fields should probably be renamed too).

lethosor added a commit to DFHack/df-structures that referenced this pull request Dec 26, 2015
…nt to running ./dfhack and then typing "echo foo" into the console. uses shell argument splitting, so "./dfhack +somecommand 'foo bar' baz" does the right thing. See DFHack#755.
@BenLubar
Copy link
Copy Markdown
Member Author

Ok, so DF does some weird stuff with command line arguments.

My new code should handle everything, but the way DF parses ./dfhack +foo "-bar -baz" means that foo gets two arguments, each starting with a hyphen. There's no way to differentiate between that and ./dfhack +foo -bar -baz, unfortunately.

However, I don't think there are any dfhack commands that need space-hyphen inside any of their arguments, so this shouldn't be a problem.

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