这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@michaelshobbs
Copy link
Member

To be clear, this is a first pass. Please have a look and beat it up.

Includes options to enable tracing, auto rm containers on run, and "quiet" output. The command line args just set env variables and thus can be used for multiple plugins/commands simultaneously.

This also sets DOKKU_QUIET_OUTPUT if we do not have a tty.

Copy link
Member

Choose a reason for hiding this comment

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

Why this change

Copy link
Member Author

Choose a reason for hiding this comment

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

The help message header changed. This allows for additional dokku args without changing the test.

@josegonzalez
Copy link
Member

Might make sense to have a shortcut for DOKKU_QUIET_OUTPUT?

@michaelshobbs
Copy link
Member Author

Shortcut? We expose --quiet or -q to set it. Is that what you mean?

@josegonzalez
Copy link
Member

No I mean like an info2_quiet function. Not sure how useful that would be in practice though.

@michaelshobbs
Copy link
Member Author

Ah! Yeah I was going to do something like that. Forgot between yesterday and today. 😄 I'll take a stab at it.

@alessio
Copy link
Contributor

alessio commented Feb 6, 2015

Please use just "name() {}" instead of "function name() {}". The use of function is the ugliest POSIX-incompatible bashism :)

@alessio
Copy link
Contributor

alessio commented Feb 6, 2015

I'd also suggest to prepend the logging functions (infoN, verbose, warn, etc) with a prefix (dokku_log_$funcname? whatever) to expose them as a sort of consistent public interface to external plugins. A namespace-style prefix would also avoid namespace clashes with functions that could be possibly defined by 3rd-party plugins.

Good job though, thanks!

@josegonzalez
Copy link
Member

This project is a bash project, and all the files reference the bash interpreter at the top, so I don't see any "bashisms" as bad :) Good call on the function prefixing though.

@michaelshobbs
Copy link
Member Author

From http://tldp.org/LDP/abs/html/functions.html:

Wherever there is repetitive code, when a task repeats with only slight variations in procedure, then consider using a function.

function function_name {
command...
}

or
function_name () {
command...
}

This second form will cheer the hearts of C programmers (and is more portable).

As mentioned, this is distinctly a bash project with no desire to be portable to other shells. That being said if there is additional push back, I don't have a strong position on modifying the function syntax.

michaelshobbs added a commit that referenced this pull request Feb 6, 2015
first stab at a common functions library. include argument parsing and a few definitions wired up. closes #932. closes #945
@michaelshobbs michaelshobbs merged commit a02f32e into master Feb 6, 2015
@michaelshobbs
Copy link
Member Author

@alessio i just came across this. https://github.com/progrium/bashstyle
@progrium backs you on not using function 😄

I suppose that's additional push back 😉 I'll refactor it.

@josegonzalez josegonzalez deleted the mh-common-functions branch February 7, 2015 00:19
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.

4 participants