ASSETS.cli.config do |cnf| cnf.options_set do |options_set, options| options_set.add("--help", "offers a help") do |options, sesssion| conf = ASSETS.cli.config puts conf.people_filters.help if hpf = SCR.get_arg("-filters") puts conf.input_filters.help if hif = SCR.get_arg("-input-filters") puts conf.options_set.help if ho = SCR.get_arg("-options") puts conf.usecases.help if huc = SCR.get_arg("-usecases") puts [ "Please specify one of the below:", " -filters to display available filters on people", " -input-filters to display available filters on input data", " -options to dislpay available options", " -usecases to display available usecases" ].join("\n") unless hpf || hif || ho || huc exit end desc = "fix the current session to work with this schema" options_set.add("-schema-id", desc) do |options, session| sch_name = SCR.get_arg("-schema-id", with_param: true) sch_id = session.schemas.to_id(sch_name) unless sch_id msg = "You need to specify a correct schema id or name. '#{sch_name}' does not exist" session.logger.error(msg) exit(1) end options.deep_merge!(people: {filter: {details: {schema_id: sch_id}}}) session.logger.info("Setting schema #{session.schemas.to_name(sch_id)}") session.schema = sch_id end desc = "deprecated: used to be used to specify the input file when using -get-partial" options_set.add("-entries-from", desc) do |options, session| options.deep_merge!(input: {entries_from: true}) end desc = "locally cache all the people manager by retrieving from the server" options_set.add("-get-people", desc) do |options, session| options.deep_merge!(people: { get: {from: :remote, type: :full} }) end options_set.add(["-dry-run", "-simulate"], "runs in dry-run (no requests sent to server)") do |options, session| options[:dry_run] = true options[:simulate] = true session.config.dry_run! end desc = "ignores threshold limitations on requests for this session (skip batch belt)" options_set.add("-skip-batch-policy", desc) do |options| options.deep_merge!(skip: {batch_policy: true}) end desc = "will not run the api policies defined for the enviro" options_set.add("-skip-api-policies", desc) do |options| options.deep_merge!(skip: {api_policies: true}) end options_set.add("-feed-only-stats", "shows only stats when giving feedback") do |options| options.deep_merge!(feedback: {only_stats: true}) end desc = "deprecated: used to be used to avoid reloading people after launch" options[:end_get] = true options_set.add("-no-get", desc) do |options| options[:end_get] = false end desc = "force search mode to 'strict' when pairing input entries with existing people." desc += " Besides id and external_id it will not try to find by email unless external_id is not specified" options_set.add("-search-strict", desc) do |options| options.deep_merge!(search: {strict: true}) end desc = "search mode that will try to find people using email when id and external_id have failed" desc += " This option could identify existing people by their email addresses" desc += " (it should not be used in orgs where multiple people usually have the same email address)" options_set.add("-search-soft", desc) do |options| options.deep_merge!(search: {soft: true, strict: false}) end desc = "silence notifications on account creation or invites" options_set.add(["-no-invites", "-exclude-invites"], desc) do |options| options.merge!(send_invites: false) end desc = "people with account will be reinvited if they haven't accepted the invitation" options_set.add("-send-invites", desc) do |options| options.merge!(send_invites: true) end options_set.add("-exclude-core", "core input data is not used on the update") do |options| options.deep_merge!(exclude: {core: true}) end options_set.add("-exclude-filter-tags", "filter_tags is not set with the input data") do |options| options.deep_merge!(exclude: {filter_tags: true}) end options_set.add("-exclude-external-id", "external_id is not set with the input data") do |options| options.deep_merge!(exclude: {external_id: true}) end options_set.add("-exclude-supervisor", "supervisor_id is not set with the input data") do |options| options.deep_merge!(exclude: {supervisor: true}) end options_set.add("-exclude-email", "email is not set with the input data") do |options| options.deep_merge!(exclude: {email: true}) end options_set.add("-exclude-name", "name is not set with the input data") do |options| options.deep_merge!(exclude: {name: true}) end options_set.add("-exclude-details", "details are not set with the input data") do |options| options.deep_merge!(exclude: {details: true}) end options_set.add("-exclude-account", "account is not set with the input data") do |options| options.deep_merge!(exclude: {account: true}) end options_set.add("-exclude-policy-groups", "policy_group_ids is not set with the input data") do |options| options.deep_merge!(exclude: {policy_groups: true}) end options_set.add("-default-tag", "default_tag is not set with the input data") do |options| options.deep_merge!(exclude: {default_tag: true}) end options_set.add("-exclude-abilities", "permissions_custom is not set with the input data") do |options| options.deep_merge!(exclude: {abilities: true}) end options_set.add("-exclude-login-providers", "login_provider_ids is not set with the input data") do |options| options.deep_merge!(exclude: {login_providers: true}) end end end