Update cheatsheets

This commit is contained in:
ivuorinen
2024-08-22 00:15:40 +00:00
parent bef5f39123
commit ec4def1435
7 changed files with 160 additions and 3 deletions

41
tldr/httpie Normal file
View File

@@ -0,0 +1,41 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# httpie
> A user friendly HTTP tool.
> More information: <https://github.com/httpie/httpie>.
- Send a GET request (default method with no request data):
`http {{https://example.com}}`
- Send a POST request (default method with request data):
`http {{https://example.com}} {{hello=World}}`
- Send a POST request with redirected input:
`http {{https://example.com}} < {{file.json}}`
- Send a PUT request with a given JSON body:
`http PUT {{https://example.com/todos/7}} {{hello=world}}`
- Send a DELETE request with a given request header:
`http DELETE {{https://example.com/todos/7}} {{API-Key:foo}}`
- Show the whole HTTP exchange (both request and response):
`http -v {{https://example.com}}`
- Download a file:
`http --download {{https://example.com}}`
- Follow redirects and show intermediary requests and responses:
`http --follow --all {{https://example.com}}`

12
tldr/https Normal file
View File

@@ -0,0 +1,12 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# https
> This command is an alias of `http`.
- View documentation for the original command:
`tldr http`

View File

@@ -12,7 +12,7 @@ source: https://github.com/tldr-pages/tldr.git
`man {{command}}`
- Open the man page for a command in a browser:
- Open the man page for a command in a browser (requires the `BROWSER` variable to be set):
`man --html {{command}}`

View File

@@ -36,6 +36,6 @@ source: https://github.com/tldr-pages/tldr.git
`mv --verbose {{path/to/source}} {{path/to/target}}`
- Specify target directory (convenient in situations when the target directory has to be the first argument):
- Specify [t]arget directory so that you can use external tools to gather movable files:
`ls | {{parallel|xargs}} mv -t {{path/to/target_directory}}`
`{{find /var/log -type f -name '*.log' -print0}} | {{xargs -0}} mv --target-directory {{path/to/target_directory}}`

42
tldr/uv Normal file
View File

@@ -0,0 +1,42 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# uv
> A fast Python package and project manager.
> Some subcommands such as `uv tool` and `uv python` have their own usage documentation.
> More information: <https://docs.astral.sh/uv/reference/cli>.
- Create a new Python project in the current directory:
`uv init`
- Create a new Python project in a directory with the given name:
`uv init {{project_name}}`
- Add a new package to the project:
`uv add {{package}}`
- Remove a package from the project:
`uv remove {{package}}`
- Run a script in the project's environment:
`uv run {{path/to/script.py}}`
- Run a command in the project's environment:
`uv run {{command}}`
- Update a project's environment from `pyproject.toml`:
`uv sync`
- Create a lock file for the project's dependencies:
`uv lock`

33
tldr/uv-python Normal file
View File

@@ -0,0 +1,33 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# uv python
> Manage Python versions and installations.
> More information: <https://docs.astral.sh/uv/reference/cli/#uv-python>.
- List all available Python installations:
`uv python list`
- Install a Python version:
`uv python install {{version}}`
- Uninstall a Python version:
`uv python uninstall {{version}}`
- Search for a Python installation:
`uv python find {{version}}`
- Pin the current project to use a specific Python version:
`uv python pin {{version}}`
- Show the `uv` Python installation directory:
`uv python dir`

29
tldr/uv-tool Normal file
View File

@@ -0,0 +1,29 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# uv tool
> Install and run commands provided by Python packages.
> More information: <https://docs.astral.sh/uv/reference/cli/#uv-tool>.
- Run a command from a package, without installing it:
`uv tool run {{command}}`
- Install a Python package system-wide:
`uv tool install {{package}}`
- Upgrade an installed Python package:
`uv tool upgrade {{package}}`
- Uninstall a Python package:
`uv tool uninstall {{package}}`
- List Python packages installed system-wide:
`uv tool list`