From cb1b5c512875d1fc0003fc21d39f5dba1c4059f8 Mon Sep 17 00:00:00 2001 From: Malte Janz Date: Sun, 30 Jun 2024 15:21:54 +0200 Subject: [PATCH] Little cleanup --- CHANGELOG.md | 1 + README.md | 15 +++++++++------ src/main.rs | 16 ++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b3171c..ade225a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Fixed `--in-flight-limit` to actually be respected (wasn't implemented correctly) - Changed default `in_flight_limit` to `8` (from `16`) as that seemed like a better performing number - Implemented all criteria filter types and added `product_variants.yaml` +- Removed `sync --verbose` option for now, as it wasn't implemented # v0.3.0 - Added `associations` entry for schema (used on export only) diff --git a/README.md b/README.md index 6c3e6e0..76bdce8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ to export data into (CSV) files or import data from (CSV) files. - It's fast, with a focus on performance - Every entity and field available in the API can be exported / imported -- Import / Export profiles are just `.yaml` files +- Supports data filtering and sorting using the API criteria +- Import / Export profiles (schema's) are just `.yaml` files - Which can be copied + adapted + shared freely - Profiles include a scripting engine for arbitrary data transformations - For now only supports CSV files @@ -23,7 +24,7 @@ to export data into (CSV) files or import data from (CSV) files. ```bash cargo install sw-sync-cli ``` -Same command can be used for updates. +Same command can be used for updates. See [crate](https://crates.io/crates/sw-sync-cli) ### Manual head to [GitHub releases](https://github.com/MalteJanz/sw-sync-cli/releases) and download the right binary for your operating system. @@ -31,7 +32,7 @@ Then either execute the binary directly or put it in your `PATH`. ## Usage -1. Setup an [integration](https://docs.shopware.com/en/shopware-6-en/settings/system/integrationen?category=shopware-6-en/settings/system) inside shopware. +1. Set up an [integration](https://docs.shopware.com/en/shopware-6-en/settings/system/integrationen?category=shopware-6-en/settings/system) inside shopware. 2. Call `sw-sync-cli auth` with the required arguments (credentials) > [!Note] @@ -40,10 +41,13 @@ Then either execute the binary directly or put it in your `PATH`. 3. Call `sw-sync-cli sync` in either `-m import` or `-m export` mode, with a profile (`schema.yaml`) and data file `data.csv` -### Profiles +> [!Info] +> You can call `sw-sync-cli help` at any time to get more information + +### Profiles (sync schema) To get started take a look at [Profiles in this repository](https://github.com/MalteJanz/sw-sync-cli/tree/main/profiles). -The structure of a profile `.yaml` is as follows: +The structure of a profile (sync schema) `.yaml` is as follows: ```yaml entity: product @@ -129,5 +133,4 @@ deserialize_script: | linked: true, currencyId: "b7d2554b0ce847cd82f3ac9bd1c0dfca", }); - ``` diff --git a/src/main.rs b/src/main.rs index e530532..3b1eea8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use crate::api::SwClient; use crate::config::{Credentials, Mapping, Schema}; use crate::data::{export, import, prepare_scripting_environment, ScriptingEnvironment}; use anyhow::Context; -use clap::{ArgAction, Parser, Subcommand}; +use clap::{Parser, Subcommand}; use std::collections::HashSet; use std::path::PathBuf; use std::sync::Arc; @@ -55,10 +55,9 @@ enum Commands { #[arg(short, long)] limit: Option, - /// Verbose output, used for debugging - #[arg(short, long, action = ArgAction::SetTrue)] - verbose: bool, - + // Verbose output, used for debugging + // #[arg(short, long, action = ArgAction::SetTrue)] + // verbose: bool, /// How many requests can be "in-flight" at the same time #[arg(short, long, default_value = "8")] in_flight_limit: usize, @@ -78,7 +77,6 @@ pub struct SyncContext { /// specifies the input or output file pub file: PathBuf, pub limit: Option, - pub verbose: bool, pub scripting_environment: ScriptingEnvironment, pub associations: HashSet, } @@ -98,10 +96,10 @@ async fn main() -> anyhow::Result<()> { schema, file, limit, - verbose, + // verbose, in_flight_limit, } => { - let context = create_context(schema, file, limit, verbose, in_flight_limit).await?; + let context = create_context(schema, file, limit, in_flight_limit).await?; match mode { SyncMode::Import => { @@ -151,7 +149,6 @@ async fn create_context( schema: PathBuf, file: PathBuf, limit: Option, - verbose: bool, in_flight_limit: usize, ) -> anyhow::Result { let serialized_schema = tokio::fs::read_to_string(schema) @@ -187,7 +184,6 @@ async fn create_context( scripting_environment, file, limit, - verbose, associations, }) }