Code Monkey home page Code Monkey logo

devcli's People

Contributors

adrianolisboa avatar cmllacrspm avatar marcosx avatar mavcunha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

devcli's Issues

Create command is not present anymore

I'm trying to create a new cli, but the create command as described in the README is not working anymore

Steps

  • execute ./devcli create -n mytool -d ~/Projects/myproject

Actual result: "'create' not found"

Extra information:

  • Looking at the code, I found a twin create command, however, this command creates a symbolic link to the original devli executable.
  • This does not block me from using the CLI as I can copy it myself and delete the code I don't need, however, I will be using this devcli for a video tutorial that I'm doing and it would be great to have the create functionality back, because it will be much easier for people to use it.

Improve documentation with Literate programming

Problem

It requires a lot of effort to know how to use the devcli (read the code, read the examples). Even though the source code comes with examples of subcommands for connecting with a vpn, vagrant, or share git repositories; it is hard to differentiate what is part of the core functionality of devcli and what is merely part of the solution for the example.

Possible solutions

There are plenty things that can be done to improve documentation. Here are some from the top of my head:

  • Add a tutorial.md explaining step by step how to customize devcli;
  • Move the examples to another repository to avoid confusions;
  • Add more comments in the source.

I would like to suggest the last options as a viable solution to describe what things are important (part of the core) and what is part of a example.

Basically my vision is to create a documentation pretty similar as what jasminejs has https://jasmine.github.io/2.4/introduction.html, it is called literate programming and is meant to use the comments from the source code to generate the documentation https://en.wikipedia.org/wiki/Literate_programming.

I would like to know your comments, ideas. If we agree in some solution then later we can figure out "the how", by now I am more interested in "the what" (improve documentation).

How to handle DEBUG

The way to debug currently is by running the command with _DEBUG but for some reason it was always being set to true regardless of how we passed the command or even defined the variable.

We also noticed that it only happens in the else of an if that checks the bash version, which seems odd.

On our CLI we just removed the DEBUG set line (devcli:31) and used a plain env var to enable/disable debug logs, like DEBUG=true leave-cli test unit.

If removing that line will cause trouble elsewhere, another option would be to check if the env var is already set and only execute the logic if it isn't, like this:

DEBUG=${DEBUG:-$(eval "[[ -n \${${MAIN_COMMAND^^}_DEBUG} ]] && echo 'true' ")}

Let us know what you think and we can make a PR with these changes.

Arguments on is_helper_function

Hi

devcli command was silently failing when I tried to create a new cli:

➜ fjunior:devcli[master]$ ./devcli create -n foo -d /tmp/foo
➜ fjunior:devcli[master]$

After some debugging I found out that the script returned after is_helper_function execution:

➜ fjunior:devcli[master]$ bash -x ./devcli create -n foo -d /tmp/foo
(...)
++ is_help_mode
++ [[ -z '' ]]
++ return
+ [[ -n foo -d /tmp/foo == \h\e\l\p ]]
+ [[ -z -n foo -d /tmp/foo ]]

As far as I understood the function expands the arguments and check if there are empty:

function is_help_mode() {
  [[ -z "${@}" || "${1}" == 'help' ]]
}

That works fine when you use it within the main command, devcli. But as create is invoked that reference does not work and the argument list is always empty:

➜ fjunior:devcli[master]$ ./devcli create -n foo -d /tmp/foo
On create script -n foo -d /tmp/foo
On is help

I've fixed it by explicitly passing the arguments to the function:

# skip if no argument was given or help needed.
is_help_mode "${@}" && return

I'm not sure if that's how it was meant to be used, specially after reading the previous discussion on this pull request.

Happy to help and/or open a PR with the fix, but I wanted to check with there was a better way to solve it first.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.