Giter Club home page Giter Club logo

argmark's Introduction

argmark's People

Contributors

devanshkv avatar fossabot avatar lennertvandevelde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

argmark's Issues

question on table syntax

Hello, thanks for your tool! In argdown README (I could not run or fix that program) there is a table like

|Short|Long    |Default                |Description
|-----|--------|-----------------------|----------------------------------------
|`-h` |`--help`|                       |show this help message and exit
|     |`--sum` |<built-in function max>|sum the integers (default: find the max)

In your example, it is

|short|long|default|help|
| :---: | :---: | :---: | :---: |
|`-h`|`--help`||show this help message and exit|
|`-f`|`--files`|`None`|Files to read.|

However, in Markdown specifications (like this one https://linux.die.net/man/5/pandoc_markdown) I could only find that '+' should be used on the intersection of rows and columns (however, your | works too). Could you please explain where you got that syntax and what it means?

Error when running

Just ran across your tool. But I got some errors when trying to run it.

Traceback (most recent call last):
  File "/Users/joakim/src/hass/home-assistant/venv/bin/argmark", line 8, in <module>
    sys.exit(main())
  File "/Users/joakim/src/hass/home-assistant/venv/lib/python3.9/site-packages/argmark/argmark.py", line 187, in main
    gen_help(f.readlines())
  File "/Users/joakim/src/hass/home-assistant/venv/lib/python3.9/site-packages/argmark/argmark.py", line 75, in gen_help
    lines = lines[:lastline]

This was trying to run on: https://github.com/danielperna84/ha-philipsjs/blob/master/haphilipsjs/__init__.py

Argmark not creating markdown

I ran argmark with the following command against this repo: https://github.com/Relyte/cosmos-multivote

argmark -f multi-vote.py

It gave no output against that file. I did get it working by creating a new file (multi-vote-copy.py) that had the following contents:

import argparse

parser = argparse.ArgumentParser(
    prog="multi-vote.py",
    description="Create json file for multiple votes in a single transaction",
    formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
    "--denom",
    dest="denom",
    required=False,
    default="ukuji",
    help="native chain denom",
)
parser.add_argument(
    "--daemon",
    dest="daemon",
    required=False,
    default="kujirad",
    help="daemon for sending tx",
)
parser.add_argument(
    "-c",
    "--chain_id",
    dest="chain_id",
    required=False,
    default="cosmoshub-4",
    help="Chain ID (ex. kaiyo-1)",
)
parser.add_argument(
    "-e",
    "--endpoint",
    dest="endpoint",
    required=False,
    help="RPC endpoint",
)
parser.add_argument(
    "-m",
    "--memo",
    dest="memo",
    help="Memo to send with votes",
)
parser.add_argument(
    "-k",
    "--keyname",
    dest="keyname",
    required=False,
    help="Wallet to vote from",
)
parser.add_argument(
    "-b",
    "--keyringbackend",
    dest="keyringbackend",
    default="test",
    required=False,
    help="Keyring Backend type",
)
parser.add_argument(
    "-s",
    "--send_address",
    dest="send_address",
    required=True,
    help="Address to vote from",
)
parser.add_argument(
    "-v",
    "--vote",
    dest="vote",
    action="append",
    required=True,
    help="Votes in the format of `proposal_id:vote_option` (eg: 110:no 111:yes 112:veto 113:abstain)",
)
parser.add_argument(
    "-d",
    "--dry-run",
    dest="dryrun",
    default=False,
    required=False,
    action="store_true",
    help="Do not sign or broadcast tx, just prepare the .json file",
)

args=parser.parse_args()

When run against this file it did properly create the markdown file. I'm assuming the issue is due to my argparse arguments being defined in the parseArgs function as opposed to main.

In case it is helpful, I ran argmark with verbose enabled against the multi-vote.py file and got the following output:

2022-12-27 16:17:22,874 - gen_help -root - DEBUG - import argparse

import json



from subprocess import run

from time import sleep, strftime

from getpass import getpass





def parseArgs():

    """Parse and return argparse arguments"""

    parser = argparse.ArgumentParser(

        prog="multi-vote.py",

        description="Create json file for multiple votes in a single transaction",

        formatter_class=argparse.ArgumentDefaultsHelpFormatter,

    )

    parser.add_argument(

        "--denom",

        dest="denom",

        required=False,

        default="ukuji",

        help="native chain denom",

    )

    parser.add_argument(

        "--daemon",

        dest="daemon",

        required=False,

        default="kujirad",

        help="daemon for sending tx",

    )

    parser.add_argument(

        "-c",

        "--chain_id",

        dest="chain_id",

        required=False,

        default="cosmoshub-4",

        help="Chain ID (ex. kaiyo-1)",

    )

    parser.add_argument(

        "-e",

        "--endpoint",

        dest="endpoint",

        required=False,

        help="RPC endpoint",

    )

    parser.add_argument(

        "-m",

        "--memo",

        dest="memo",

        help="Memo to send with votes",

    )

    parser.add_argument(

        "-k",

        "--keyname",

        dest="keyname",

        required=False,

        help="Wallet to vote from",

    )

    parser.add_argument(

        "-b",

        "--keyringbackend",

        dest="keyringbackend",

        default="test",

        required=False,

        help="Keyring Backend type",

    )

    parser.add_argument(

        "-s",

        "--send_address",

        dest="send_address",

        required=True,

        help="Address to vote from",

    )

    parser.add_argument(

        "-v",

        "--vote",

        dest="vote",

        action="append",

        required=True,

        help="Votes in the format of `proposal_id:vote_option` (eg: 110:no 111:yes 112:veto 113:abstain)",

    )

    parser.add_argument(

        "-d",

        "--dry-run",

        dest="dryrun",

        default=False,

        required=False,

        action="store_true",

        help="Do not sign or broadcast tx, just prepare the .json file",

    )



    import argmark
    argmark.md_help(parser)

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.