jeremieca / pulsion

Pulsion centralize all commands of your project in one unique place with no pain.
5 stars 2 forks source link

Verbose helper should handle output redirection and be shorter to write #2

Closed asiegf closed 8 years ago

asiegf commented 8 years ago
exec 1> /dev/null
exec 3>&1

verbose 1 "printed" >&3
verbose 1 "not printed"
random_verbose_command  # not flooding the terminal
jeremieca commented 8 years ago

For the moment I rename verbose to print. But verbose still works in deprecated mode.

I also create a command p that is a shorter alias for print. Moreover, now print and p command don't need verbose level anymore. By default it is set to 1 (high level).

So you can write :

print "Hello" instead of print 1 "Hello" p "Hello" instead of p 1 "Hello"

jeremieca commented 8 years ago

I’m developing a generic tool to manage streams. It must solve the second problem. But hide the output of all commands by default is not the behaviour that I want.

I think of something like that :

stream::print 2 ls  # Display the ls output if verbose level >= 2

See you soon.

jeremieca commented 8 years ago

Streams are now available. A documentation is coming soon. Previous example works.

jeremieca commented 8 years ago

The documentation about streams is now available here : Streams documentation

asiegf commented 8 years ago

The updates are awesome. Thanks.