Skip to content
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

Alias Command #701

Closed
expwnent opened this issue Sep 26, 2015 · 7 comments
Closed

Alias Command #701

expwnent opened this issue Sep 26, 2015 · 7 comments
Assignees
Labels
idea Suggestions, etc.
Projects
Milestone

Comments

@expwnent
Copy link
Member

Problem: there are about 70 scripts in the main scripts directory, counting third party scripts.. Most people will not use most scripts. This makes the output of the "ls" internal command cluttered and confusing. We could put lots of scripts into well-organized folders but that would require excessive typing for the scripts people do use.

One possible solution is allowing people to "alias" scripts in subfolders as if they were in the main folder.

alias gui/hack-wish hack-wish
alias repeat -time 1 months -command repeatMonthly

If this command is set up properly, it will be possible for us to arrange scripts into subfolders and have people use dfhack.init to alias the ones they use into the main folder.

I'm not sure how good an idea this is. Thoughts?

@expwnent expwnent added the idea Suggestions, etc. label Sep 26, 2015
@PeridexisErrant
Copy link
Contributor

I really, really like this idea. It removes almost the entire downside of using the subfolders as namespaces, which has obvious benefits in organising stuff. Potentially also plugins, at some point.

@lethosor
Copy link
Member

+1. Note that most alias commands I've encountered take the alias name first (e.g. bash's built-in alias command).
70 scripts don't make up even half of the output of ls, though, so I have mixed feelings about moving a lot of scripts to subdirectories. I feel like this would be more useful for things like your repeatMonthly example - if a lot of scripts are moved to subdirectories, it would be simpler to add those directories to the script search path than adding aliases for all of them in dfhack.init.

@maxthyme
Copy link

Nothing to add beyond it being a great idea, and useful forward compatibility step as well I would think.

@PeridexisErrant
Copy link
Contributor

There are a couple of general categories of tools:

  • Persistent (eg many fix scripts) - generally invoked from an init automatically
  • GUI (etc) - mostly kebound
  • Modding tools - invoked from raws
  • Interactive, eg the liquids plugin. Alias could shorten the invocation, especially if in a folder
  • One-use tools and commands, eg dig*, clean *, etc.

It's the last category that this is a big win for - especially because different people have favourite commands and flags for them. I'd probably alias cle="multicmd clean all; cleanowned scattered x; autodump destroy" and alias rep="repeat -time 1 months" for example, but that's just me.

As above, I'd prefer to match the bash syntax as closely as possible here.

@lethosor lethosor modified the milestone: 0.40.24-r5 Nov 2, 2015
@lethosor lethosor modified the milestones: 0.40.24-r5, 0.40.24-r6 Nov 26, 2015
@lethosor lethosor modified the milestones: 0.42.xx-r1, 0.42.xx-r2 Dec 18, 2015
@lethosor lethosor modified the milestones: 0.42.06-r2, 0.42.06-r3 May 10, 2016
@lethosor lethosor modified the milestones: 0.43.05-r1, 0.43.05-r2 Jul 14, 2016
@lethosor lethosor added this to Wishlist in 0.43.05-r2 Jun 3, 2017
@lethosor lethosor self-assigned this Jun 18, 2017
lethosor added a commit that referenced this issue Jun 19, 2017
@lethosor
Copy link
Member

This is mostly done. There currently isn't anything preventing aliases from referring to themselves, which I hope to fix, but the main functionality is implemented now.

@PeridexisErrant
Copy link
Contributor

Hooray!

(other comment: you've put the new docs below the wrong link anchor, so cross-references to cls will now refer to alias, and there's no way to reference alias - just move the old anchor below the new docs, and add a new one above 😄 )

@lethosor
Copy link
Member

Oops! I didn't notice that because the section links within that document worked as expected. Will fix.

lethosor added a commit that referenced this issue Jun 23, 2017
- Improve link in Binpatches.rst
- Fix `alias` anchor in Core.rst (ref #701)
- Increase depth of Plugins.rst table of contents. Some plugins were hard to
  find because they fit in multiple categories.
lethosor added a commit that referenced this issue Jul 12, 2017
Addresses an issue with recursive aliases crashing (#701)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea Suggestions, etc.
Projects
No open projects
0.43.05-r2
Wishlist
Development

No branches or pull requests

4 participants