This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/docs/core-concepts/1203-client.md
Marcos Lilljedahl b47b51401f Attempt to automatically select OS tab based on user user-agent
This is a quick fix to attempt to automatically select the user's OS tab
on the pages that requires so which potentially avoids users following
incorrect docs

Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
2022-03-23 14:05:08 -03:00

1.7 KiB
Raw Blame History

slug displayed_sidebar
/1203/client europa

Interacting with the client

dagger.#Plan has a client field that allows interaction with the local machine where the dagger command line client is run. You can:

  • Read and write files and directories;
  • Use local sockets;
  • Load environment variables;
  • Run commands;
  • Get current platform.

Accessing the file system

You may need to load a local directory as a dagger.#FS type in your plan:

Its also easy to write a file locally:

Using a local socket

You can use a local socket in an action:

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

<Tabs defaultValue={window.navigator.userAgent.indexOf('Win') != -1 ? 'windows': 'unix'} groupId="client-env">

Environment variables

Environment variables can be read from the local machine as strings or secrets, just specify the type:

Running commands

Sometimes you need something more advanced that only a local command can give you:

:::tip You can also capture stderr for errors and provide stdin for input. :::

Platform

If you need the current platform though, theres a more portable way than running uname like in the previous example: