
Product
Introducing Socket MCP for Claude Desktop
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
This is a simple Python tool to convert structured data such as yaml
,toml
, or json
to command line arguments. It
is intended to allow for easy configuration of command line tools.
Homebrew coming eventually. For now you can install it with pip:
pip install struct2args
or Pipx:
pipx install struct2args
Usage is pretty straightforward. It reads a structured data file and outputs a list of command line arguments as a string. The file should have the following format:
__args__: # This is required. Each item in the list is a set of arguments.
- _name: 'nginx-test' # The name to search for
name: 'nginx-test-{% gitcommit %}'
p: '80:{% get_free_port 80 %}'
_pos: 'nginx'
- _name: 'nginx-detached'
name: 'nginx-detached-{% gitcommit %}'
p: '80:80'
_pos:
- '-d'
- 'nginx'
Anything that starts with an underscore is a special command and won't be converted to an argument. The following special commands are supported:
__args__
: Required in all files. This should be a list of arguments
_pos*
: Anything starting with _pos
will be converted to a positional argument. If it is a list, each item will be
interpreted as a separate positional argument.
Otherwise, all other keys will be converted to command line arguments. The key name will be the argument name and the
value. So in the example above: name
will be converted to --name nginx-test-{% gitcommit %}
.
To use the tool you can run it two ways:
```bash
struct2args <file> | xargs <command>
```
--cmd
argument```bash
struct2args --cmd <command> <file>
```
The tool uses Jinja2 templating to allow for dynamic arguments. The standard functions are available as well as the ones from jinja2-git.
In addition, there is a custom tag of get_free_port
. This will return a free port on the host machine starting at the
port number specified. For example, {% get_free_port 80 %}
will return a free port starting at 80. This is useful for
things like port forwarding. You can declare a maximum port number by passing in an optional second argument. For
example {% get_free_port 80 90 %}
will return a free port between 80 and 90.
FAQs
A tool to convert structured data to cli arguments
We found that struct2args demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.