Your comments

I've seen that some of my co-workers did indent it wrongly. You have to indent the last two lines at the same column like the "if line.empty()" is, otherwise nearly nothing will happen.
As always you install it by putting it into your User folder.
General casting is a bad habit. Please don't implement such things. Programmers should do that on their own need.
I've hacked the existing a bit. It copies the current line if nothing selected. Otherwise it inserts the selection after the selection. For duplicating complete lines you have to select the whole line (including the newline character).

import sublime_plugin

class DuplicateLineCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        for region in self.view.sel():
            line = region
            if line.empty():
                line = self.view.full_line(region)
            line_contents = self.view.substr(line)
            self.view.insert(edit, line.end(), line_contents)
You can use this in your user keymap file (replace super with ctrl when on windows or linux):
{ "keys": ["super+shift+s"], "command": "prompt_save_as" },
I also replaced the first line of my code above with these:

        settings = sublime.load_settings("Global.sublime-settings")
        arg_list_prefix = settings.get("arg_list_prefix", [])
It's a little bit better but it doesn't source the .profile 'cause bash isn't called as a login shell.

An optional parameter shell=False|True would be good anyway for people who know what they do.

I've now added these lines before line 19 as an example:

        arg_list_prefix = ['bash', '-l', '-c']
        if arg_list_prefix:
            from pipes import quote
            arg_list = map(quote, arg_list)
            arg_list = arg_list_prefix + [' '.join(arg_list)]

I would really like to define this arg_list_prefix in my configuration file.
I've tried to run it via Finder, Dock and iTerm/Terminal. The Finder and Dock seem to be started without sourcing .profile, therefore nearly no env vars. When run from a terminal it gets all variables as I wished.
Do you think that it's awkward to implement an optionally definable shell command (e.g. "bash --login") to use as a wrapper for all shell calls from the config files? This way one could choose (by configuration) to either run them isolated or from a specific point of view (e.g. virtualenv or a custom wrapper which loads a proper virtualenv or shell env according to path etc. - at least that's what I would want to brew for myself...).
Then I would like to have this behavior configurable. I have to do organizational operations very seldom - most of the time I just cmd+P and peep/change it. Thus I would like to avoid automatic unfolding stuff in my sidebar.
As long as it's fast I won't have a problem with that. I just think of my colleagues who work with Magento and have over 10000 files in their code base.
Perhaps only update open folders (unfolded tree nodes) to be faster?