mycmd
hasura-ci-cd-action
mycmd | hasura-ci-cd-action | |
---|---|---|
1 | 2 | |
4 | 35 | |
- | - | |
3.1 | 0.0 | |
17 days ago | 10 months ago | |
Shell | Shell | |
MIT License | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
mycmd
-
Bash functions are better than I thought
Woah, this is very cool. I may try to adopt this.
I recently discovered, similar to the author of the post for this thread, that local variables are dynamically scoped.
I have been writing a lot more shell scripts lately, using a "library" [1] of sorts I've been writing. When I was debugging one of my scripts that uses mycmd, I discovered that I had failed to declare some of my variables local and they were leaking out to the global scope.
I had recently added functionality to call a set of functions on script exit, so I added something that would output the defined variables, in hopes that I could write something that will output them at the beginning and then the end and show the difference. I was surprised when variables defined in my dispatch function [2] for those at exit functions were showing up, even though they were definitely defined as local. It was then that I dug around and discovered the dynamic scope of variables.
I've been trying to figure out how to accomplish what I desire but exclude those variables from calling functions. I haven't been able to find an obvious way to see if the variable is coming from a calling function. I might be able to use techniques like you've pointed out in your linked post to add the tracing that I want. Still need to think more on this.
---
[1] https://github.com/travisbhartwell/mycmd
hasura-ci-cd-action
-
Bash functions are better than I thought
I write a LOT of bash/shell scripts. And I don't like it, it's just part of what I have to do.
Learning a handful of bash idioms and best-practices has made a massive impact for me, and life much easier. The shell is something you cannot avoid if you're a programmer or other sort of code-wrangler.
You can interact with it + be (mostly) clueless and still get things done, but it's a huge return-on-investment to set up "shellcheck" and lookup "bash'isms", etc.
----
(Off-topic: I am convinced Ruby cannot be beaten for shell-scripting purposes. If I had a wish, it would be that every machine had a tiny Ruby interpreter on it so I could just use Ruby. I'm not even "a Ruby guy", it's just unreasonably good/easy for this sort of thing. And I keep my mind open for better alternatives constantly.)
Example of near-identical script in bash vs Ruby:
https://github.com/GavinRay97/hasura-ci-cd-action/blob/maste...
https://github.com/GavinRay97/hasura-ci-cd-action/blob/maste...
What are some alternatives?
basalt - The rock-solid Bash package manager.
murex - A smarter shell and scripting environment with advanced features designed for usability, safety and productivity (eg smarter DevOps tooling)