Ejemplo n.º 1
0
        /// <inheritdoc/>
        protected override async Task OnExecuteAsync(CommandLineApplication app)
        {
            if (string.IsNullOrEmpty(Program.Environment))
            {
                Console.WriteLine("Please set the environment context before using this command.");
                Console.WriteLine("Update environment using cmd: settings update -e [environment] \n ");
                return;
            }

            if (string.IsNullOrEmpty(InstanceId) && string.IsNullOrEmpty(InstanceGuid))
            {
                Console.WriteLine("Please provide an instanceId or instanceGuid");
                return;
            }

            if ((DataState.Equals("deleted") || DataState.Equals("all")) && (string.IsNullOrEmpty(Org) || string.IsNullOrEmpty(App)))
            {
                Console.WriteLine("Please provide org and app when listing deleted data elements.");
                return;
            }

            string instanceGuid = InstanceGuid ?? InstanceId.Split('/')[1];

            switch (DataState.ToLower())
            {
            case "deleted":
                await ListDataElements(Org, App, instanceGuid, ElementState.Deleted);

                break;

            case "all":
                await ListDataElements(Org, App, instanceGuid, ElementState.All);

                break;

            case "active":
            default:
                await ListActiveDataElements(instanceGuid);

                break;
            }

            CleanUp();
        }