ARGPARSE.H(3)

πŸ“¦
version 1.5.2 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

✨ NAME ✨

include/Zycore/ArgParse.h β€” and bestie, this is the header that lives in Zycore's Library Functions Manual, which is the fancy way of saying "hey, this is a C header, here's everything it gives you" πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

Like, first things first β€” you gotta pull in the essentials:

#include <Zycore/Types.h>
#include <Zycore/Status.h>
#include <Zycore/Vector.h>
#include <Zycore/String.h>

🌸 Classes 🌸

  • struct ZyanArgParseDefinition_
  • struct ZyanArgParseConfig_
  • struct ZyanArgParseArg_

πŸ¦‹ Typedefs πŸ¦‹

  • typedef struct ZyanArgParseDefinition_ ZyanArgParseDefinition
  • typedef struct ZyanArgParseConfig_ ZyanArgParseConfig
  • typedef struct ZyanArgParseArg_ ZyanArgParseArg

🌈 Functions 🌈

ZYCORE_EXPORT ZyanStatus ZyanArgParse (const ZyanArgParseConfig *cfg,
    ZyanVector *parsed, const char **error_token)
ZYCORE_EXPORT ZyanStatus ZyanArgParseEx (const ZyanArgParseConfig *cfg,
    ZyanVector *parsed, const char **error_token, ZyanAllocator
    *allocator)

πŸ’– Detailed Description πŸ’–

Okay so, what does this even do? It implements command-line argument parsing. That's it, that's the whole vibe. Your program gets args, and this header is the one making sense of them. Iconic behavior, truly. ✨


πŸ‘‘ Typedef Documentation πŸ‘‘

πŸ’œ typedef struct ZyanArgParseArg_ ZyanArgParseArg

Information about a parsed argument. (Like, the tea on each arg after it's been chewed up by the parser πŸ“)

πŸ’œ typedef struct ZyanArgParseConfig_ ZyanArgParseConfig

Configuration for argument parsing. (The settings that tell the parser how to do its lil job.)

πŸ’œ typedef struct ZyanArgParseDefinition_ ZyanArgParseDefinition

Definition of a single argument. (One arg's whole identity, fr.)


πŸ”₯ Function Documentation πŸ”₯

⭐ ZYCORE_EXPORT ZyanStatus ZyanArgParse (const ZyanArgParseConfig * cfg, ZyanVector * parsed, const char ** error_token)

Parse arguments according to a ZyanArgParseConfig definition. That's the whole mission statement, bestie.

🌟 Parameters

  • cfg β€” Argument parser config to use.
  • parsed β€” Receives the parsed output. Vector of ZyanArgParseArg. Ownership is transferred to the user. Input is expected to be uninitialized. On error, the vector remains uninitialized.
  • error_token β€” On error, if it makes sense, receives the argument fragment causing the error. Optional, may be ZYAN_NULL. The pointer borrows into the cfg struct and doesn't have to be freed by the user.
Not me stressing about the parsed vector lifecycle 😭 β€” it starts uninitialized, you own it once it comes back, and if things go sideways it stays uninitialized. No leaks, no drama. 🫢

✨ Returns

A ZyanStatus status determining whether the parsing succeeded.


⭐ ZYCORE_EXPORT ZyanStatus ZyanArgParseEx (const ZyanArgParseConfig * cfg, ZyanVector * parsed, const char ** error_token, ZyanAllocator * allocator)

Parse arguments according to a ZyanArgParseConfig definition.

This version allows specification of a custom memory allocator and thus supports no-libc. (Yes, no-libc. It's giving freestanding, it's giving embedded, it's giving main character energy in a bare-metal environment. πŸ”₯)

🌟 Parameters

  • cfg β€” Argument parser config to use.
  • parsed β€” Receives the parsed output. Vector of ZyanArgParseArg. Ownership is transferred to the user. Input is expected to be uninitialized. On error, the vector remains uninitialized.
  • error_token β€” On error, if it makes sense, receives the argument fragment causing the error. Optional, may be ZYAN_NULL. The pointer borrows into the cfg struct and doesn't have to be freed by the user.
  • allocator β€” The ZyanAllocator to be used for allocating the output vector's data.

✨ Returns

A ZyanStatus status determining whether the parsing succeeded.


🌸 Author 🌸

Generated automatically by Doxygen for Zycore from the source code. (Doxygen said "I got this" and honestly? It ate. πŸ’…)


And that's the whole page, bestie!! πŸŽ€πŸ’– This lil header belongs to Zycore, Version 1.5.2.0, and it's the include/Zy.../ArgParse.h(3) manual page β€” go forth and parse those arguments, you absolute legend πŸ‘‘πŸŒˆβ­

πŸ“¦ where this page comes from