FR: Pure json mode for cli --info

Aberta
#815 4 comentários 3 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
35/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
json, python
Domínio
cli

Direção de pesquisa

The request concerns the output of the --info command and the --config-export behaviour that it is compared against, both in the Python CLI. Run meshtastic --info with stdout redirected to a file to see the mixed output, then compare it with --config-export. The issue leaves open whether to add a new flag or change the default, and that decision needs a maintainer answer before any patch. Done means a JSON-only mode in which status messages go to stderr and the output is a single top-level object.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

At current the output of --info is a mix of command feedback (Connected to radio), protobuf style direct top level fields Owner: Meshtastic wxyz (wxyz) and json objects prefixed with a protobuf field name-ish: Nodes in mesh: { ...

Reading this format in any consistent way to extract information is painful to say the least. I'd propose the following:

  1. Output session specific feedback to STDERR (Connected to radio). This will never be useful in redirected output and is omitted completely for example in --config-export.
  2. Stick to one format that's easy to process for downstream users/admins/devs. While I understand protobuf is core to the project, it sadly lacks the proliferation of useful tooling that is available for json. If backwards compatibility is desired (although I doubt anyone has written a parser for the current format that they would want to keep) I'd say add a --json-info flag to explicitly export pure json.
  3. The json mode should output only a single object, i.e. it should wrap the distinct objects under a top level object. Example much simplified format proposed below. The goal is for example to be able to do: meshtastic --info-json | jq .Owner
{
  "Owner": "Meshtastic wxyz (wxyz)",
  "My_info": { "myNodeNum": 12345, "minAppVersion": 30200, "deviceId": "xxx==", "pioEnv": "tracker-t1000-e", "rebootCount": 0, "firmwareEdition": "VANILLA", "nodedbCount": 0 },
  "Nodes_in_mesh": {
    "!xxx": { "num": 12345 }
  },
  "Preferences": {
    "device": {
      "buzzerGpio": 25
    }
  },
  "Module_preferences": {
    "mqtt": {
      "address": "mqtt.meshtastic.org"
    }
  }
}

.. and so on, you get the point.

Linguagem predominante
Python
Estrelas
855
Forks
355
Merge médio
3d 3h
PRs com merge (30d)
12

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de meshtastic/python

Todas as issues de meshtastic/python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.