Giter VIP home page Giter VIP logo

Comments (1)

pieterconradie avatar pieterconradie commented on June 4, 2024

Hi @sslupsky,

Unfortunately it is not currently possible. The command list item uses the command handler function pointer to decide if it is a command or a group item:

/// Command list item declaration
typedef struct px_cli_cmd_list_item_s
{
    px_cli_handler_t   handler;         ///< Function to be called when command is executed
    union
    {
        const px_cli_cmd_t *   cmd;     ///< pointer to command (if handler != NULL)
        const px_cli_group_t * group;   ///< pointer to group   (if handler == NULL)
    };
} px_cli_cmd_list_item_t;

So if the pointer to the handler function is NULL, it is a group item. This means that a handler function can not be assigned to a group item (in your example the "led" command to display the current state).

I used this trick to make the CLI group / command declaration as compact as possible, because the cmd/group pointer shares the same memory location using the union keyword.

Best regards,
Pieter

from px-fwlib.

Related Issues (8)

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.