{\ttfamily kdb import $<$destination$>$ \mbox{[}$<$format$>$\mbox{]}}

Where {\ttfamily destination} is the destination where the user wants the keys to be imported into. {\ttfamily format} is the format of the keys that are imported.

\subsection*{D\+E\+S\+C\+R\+I\+P\+T\+I\+ON}

If the {\ttfamily format} argument is not passed, then the default format will be used as determined by the value of the {\ttfamily sw/kdb/current/format} key. By default, that key is set to the {\ttfamily storage} format. The {\ttfamily format} attribute relies on Elektra’s plugin system to properly import the configuration. The user can view all plugins available for use by running the kdb-\/list(1) command. To learn about any plugin, the user can simply use the kdb-\/info(1) command.

This command allows a user to import an existing configuration into the key database. The configuration that the user wants to import is read from {\ttfamily stdin}. The user should specify the format that the current configuration or keys are in, otherwise the default format will be used. The default format is {\ttfamily storage} but can be changed by editing the value of the {\ttfamily /sw/elektra/kdb/\#0/current/format} key. The {\ttfamily storage} plugin can be configured at compile-\/time or changed by the link {\ttfamily libelektra-\/storage.\+so}.

\subsection*{C\+O\+N\+F\+L\+I\+C\+TS}

Conflicts can occur when importing a configuration to a part of the database where keys already exist. Conflicts when importing can be resolved using a strategy with the {\ttfamily -\/s} argument.

Specific to {\ttfamily kdb import} the following strategy exists\+:


\begin{DoxyItemize}
\item {\ttfamily validate}\+: apply metadata as received from base, and then cut+append all keys as imported. If the appended keys do not have a namespace, the namespace given by {\ttfamily -\/N} is added.
\end{DoxyItemize}

The other strategies are implemented by the merge framework and are documented in \hyperlink{md_doc_help_elektra-merge-strategy_doc_help_elektra-merge-strategy_md}{elektra-\/merge-\/strategy(7)}.

\subsection*{O\+P\+T\+I\+O\+NS}


\begin{DoxyItemize}
\item {\ttfamily -\/H}, {\ttfamily -\/-\/help}\+: Show the man page.
\item {\ttfamily -\/V}, {\ttfamily -\/-\/version}\+: Print version info.
\item {\ttfamily -\/p}, {\ttfamily -\/-\/profile $<$profile$>$}\+: Use a different kdb profile.
\item {\ttfamily -\/C}, {\ttfamily -\/-\/color $<$when$>$}\+: Print never/auto(default)/always colored output.
\item {\ttfamily -\/s}, {\ttfamily -\/-\/strategy $<$name$>$}\+: Specify which strategy should be used to resolve conflicts.
\item {\ttfamily -\/v}, {\ttfamily -\/-\/verbose}\+: Explain what is happening.
\item {\ttfamily -\/c}, {\ttfamily -\/-\/plugins-\/config}\+: Add a configuration to the format plugin.
\item {\ttfamily -\/N}, {\ttfamily -\/-\/namespace $<$namespace$>$}\+: Specify the namespace to use when writing cascading keys ({\ttfamily validate} strategy only). See \href{#KDB}{\tt below in K\+DB}.
\end{DoxyItemize}

\subsection*{K\+DB}


\begin{DoxyItemize}
\item {\ttfamily /sw/elektra/kdb/\#0/current/verbose}\+: Same as {\ttfamily -\/v}\+: Explain what is happening (output merged keys).
\item {\ttfamily /sw/elektra/kdb/\#0/current/format} Change default format (if none is given at commandline) and built-\/in default is not your preferred format.
\item {\ttfamily /sw/elektra/kdb/\#0/current/namespace}\+: Specifies which default namespace should be used when setting a cascading name. By default the namespace is user, except {\ttfamily kdb} is used as root, then {\ttfamily system} is the default ({\ttfamily validate} strategy only).
\end{DoxyItemize}

\subsection*{E\+X\+A\+M\+P\+L\+ES}

To import a configuration stored in the X\+ML format in a file called {\ttfamily example.\+xml} below {\ttfamily user/keyset}\+:~\newline
 {\ttfamily kdb import user/keyset xmltool $<$ example.\+xml}

To import a configuration stored in the {\ttfamily ini} format in a file called {\ttfamily example.\+ini} below {\ttfamily user/keyset} replacing any previous keys stored there\+:~\newline
 {\ttfamily cat example.\+ini $\vert$ kdb import -\/s cut user/keyset ini}

To import a configuration stored in the {\ttfamily ini} format in a file called {\ttfamily example.\+ini} below {\ttfamily user/keyset} keeping any previous keys stored there that aren\textquotesingle{}t present in the newly imported configuration\+:~\newline
 {\ttfamily cat example.\+ini $\vert$ kdb import -\/s import user/keyset ini}

To restore a backup (stored as {\ttfamily sw.\+ecf}) of a user\textquotesingle{}s configuration below {\ttfamily system/sw}\+:~\newline
 {\ttfamily cat sw.\+ecf $\vert$ kdb import system/sw}

\subsection*{S\+EE A\+L\+SO}


\begin{DoxyItemize}
\item \hyperlink{md_doc_help_elektra-merge-strategy_doc_help_elektra-merge-strategy_md}{elektra-\/merge-\/strategy(7)} 
\end{DoxyItemize}