private async Task <int> OnExecute()
        {
            var octoVariables = new VariableDictionary();

            var envVariables = Environment.GetEnvironmentVariables();

            foreach (var key in envVariables.Keys)
            {
                octoVariables.Add(key.ToString(), envVariables[key]?.ToString());
            }

            var content = await ReadInput(Input);

            var replaced = octoVariables.Evaluate(content, out var error);

            await WriteOutput(Output ?? Input, replaced);

            if (!string.IsNullOrEmpty(error))
            {
                Console.Error.WriteLine(error);
                return(1);
            }

            return(0);
        }
예제 #2
0
        internal override void MapResponse(Element response)
        {
            base.MapResponse(response);

            //set category
            category = response.GetValue <string>("TableCategory");
            if (category == null)
            {
                category = lastCategory;
            }

            fieldValues = new VariableDictionary();
            foreach (Element field in response.GetAll("Field"))
            {
                fieldValues.Add(field.GetValue <string>("Key"), field.GetValue <string>("Value"));
            }
        }