github.com/wmuizelaar/kpt@v0.0.0-20221018115725-bd564717b2ed/site/reference/cli/fn/source/README.md (about)

     1  ---
     2  title: "`source`"
     3  linkTitle: "source"
     4  type: docs
     5  description: >
     6    Source resources from a local directory
     7  ---
     8  
     9  <!--mdtogo:Short
    10      Source resources from a local directory
    11  -->
    12  
    13  `source` reads resources from a local directory and writes them in [Function
    14  Specification] wire format to `stdout`. The output of the `source` can be pipe'd
    15  to commands such as `kpt fn eval` that accepts Function Specification wire
    16  format. `source` is useful for chaining functions using Unix pipe. For more
    17  details, refer to [Chaining functions].
    18  
    19  ### Synopsis
    20  
    21  <!--mdtogo:Long-->
    22  
    23  ```
    24  kpt fn source [DIR] [flags]
    25  ```
    26  
    27  #### Args
    28  
    29  ```
    30  DIR:
    31    Path to the local directory containing resources. Defaults to the current
    32    working directory.
    33  ```
    34  
    35  #### Flags
    36  
    37  ```
    38  --fn-config:
    39    Path to the file containing `functionConfig`.
    40  
    41  --include-meta-resources:
    42    (DEPRECATED) include-meta-resources is no longer necessary because meta
    43    resources are included by default with kpt version v1.0.0-beta.15+.
    44  
    45  --output, o:
    46    If specified, the output resources are written to stdout in provided format.
    47    Allowed values:
    48    1. stdout(default): output resources are wrapped in ResourceList and written to stdout.
    49    2. unwrap: output resources are written to stdout, in multi-object yaml format.
    50  ```
    51  
    52  <!--mdtogo-->
    53  
    54  ### Examples
    55  
    56  <!--mdtogo:Examples-->
    57  
    58  ```shell
    59  # read resources from DIR directory and write the output on stdout.
    60  $ kpt fn source DIR
    61  ```
    62  
    63  ```shell
    64  # read resources from DIR directory, execute my-fn on them and write the
    65  # output to DIR directory.
    66  $ kpt fn source DIR |
    67    kpt fn eval - --image gcr.io/example.com/my-fn - |
    68    kpt fn sink DIR
    69  ```
    70  
    71  <!--mdtogo-->
    72  
    73  [chaining functions]:
    74    /book/04-using-functions/02-imperative-function-execution?id=chaining-functions-using-the-unix-pipe
    75  [function specification]:
    76    /book/05-developing-functions/01-functions-specification