### Test API Contract Changes Source: https://github.com/influxdata/influx-cli/blob/main/api/contract/README.md Run this command from the project root to test your API contract changes and view the generated Go code output. ```shell make openapi ``` -------------------------------- ### Run Unit Tests Source: https://github.com/influxdata/influx-cli/blob/main/README.md Execute unit tests for the Influx CLI using the make test command. ```bash make test ``` -------------------------------- ### Build Influx CLI Binary Source: https://github.com/influxdata/influx-cli/blob/main/README.md Build the Influx CLI binary using the make command. The executable will be placed in bin/$(GOOS)/influx. ```bash make ``` -------------------------------- ### Clone Influx CLI Repository Source: https://github.com/influxdata/influx-cli/blob/main/README.md Clone the influx-cli repository and navigate into the directory. This is the first step to building the CLI locally. ```bash git clone git@github.com:influxdata/influx-cli.git cd influx-cli ``` -------------------------------- ### Branch OpenAPI Submodule for Changes Source: https://github.com/influxdata/influx-cli/blob/main/api/contract/README.md Navigate to the OpenAPI submodule directory and create a new branch to track changes there. ```shell cd api/contract/openapi && git checkout -b ``` -------------------------------- ### Advanced CSV to Line Protocol Conversion Source: https://github.com/influxdata/influx-cli/blob/main/pkg/csv2lp/README.md Illustrates advanced CSV to Line Protocol conversion with custom annotations for constants, timezones, and complex data type formats. ```bash #constant measurement,test #constant tag,name,datetypeFormats #timezone -0500 t|dateTime:2006-01-02|1970-01-02,"d|double:,. ","b|boolean:y,Y:n,N|y" 1970-01-01,"123.456,78", ,"123 456,78",Y ``` ```plaintext test,name=datetypeFormats d=123456.78,b=true 18000000000000 test,name=datetypeFormats d=123456.78,b=true 104400000000000 ``` -------------------------------- ### Data Types with Default Values to Line Protocol Source: https://github.com/influxdata/influx-cli/blob/main/pkg/csv2lp/README.md Demonstrates specifying data types and default values in the CSV header for conversion to Line Protocol. This allows for cleaner CSV input. ```bash #datatype measurement,tag,string,double,boolean,long,unsignedLong,duration,dateTime #default test,annotatedDatatypes,,,,,, m,name,s,d,b,l,ul,dur,time ,,str1,1.0,true,1,1,1ms,1 ,,str2,2.0,false,2,2,2us,2020-01-11T10:10:10Z ``` ```plaintext test,name=annotatedDatatypes s="str1",d=1,b=true,l=1i,ul=1u,dur=1000000i 1 test,name=annotatedDatatypes s="str2",d=2,b=false,l=2i,ul=2u,dur=2000i 1578737410000000000 ``` ```bash m|measurement|test,name|tag|annotatedDatatypes,s|string,d|double,b|boolean,l|long,ul|unsignedLong,dur|duration,time|dateTime ,,str1,1.0,true,1,1,1ms,1 ,,str2,2.0,false,2,2,2us,2020-01-11T10:10:10Z ``` -------------------------------- ### Enable Zsh Shell Completions Source: https://github.com/influxdata/influx-cli/blob/main/README.md Enable zsh shell completions for the current session by sourcing the output of the influx completion command. ```bash # For zsh: source <(influx completion zsh) ``` -------------------------------- ### Update OpenAPI Submodule Source: https://github.com/influxdata/influx-cli/blob/main/api/contract/README.md Run this command from the project root to ensure the OpenAPI submodule is cloned and up-to-date. ```shell git submodule update --init --recursive ``` -------------------------------- ### Extract OpenAPI Templates Source: https://github.com/influxdata/influx-cli/blob/main/api/templates/README.md Command to extract all templates used by the OpenAPI generator. ```shell openapi-generator author template -g go ``` -------------------------------- ### Enable Bash Shell Completions Source: https://github.com/influxdata/influx-cli/blob/main/README.md Enable bash shell completions for the current session by sourcing the output of the influx completion command. ```bash # For bash: source <(influx completion bash) ``` -------------------------------- ### Enable PowerShell Shell Completions Source: https://github.com/influxdata/influx-cli/blob/main/README.md Enable PowerShell shell completions for the current session by invoking the output of the influx completion command. ```powershell # For pwsh: Invoke-Expression ((influx completion powershell) -join "`n`") ``` -------------------------------- ### Custom Column Separator for CSV to Line Protocol Source: https://github.com/influxdata/influx-cli/blob/main/pkg/csv2lp/README.md Shows how to define a custom column separator (e.g., ';') in the first line of the CSV for parsing. ```bash sep=; m|measurement;available|boolean:y,Y:|n;dt|dateTime:number test;nil;1 test;N;2 test;";";3 test;;4 test;Y;5 ``` ```plaintext test available=false 1 test available=false 2 test available=false 3 test available=false 4 test available=true 5 ``` -------------------------------- ### Create New Branch for API Contract Work Source: https://github.com/influxdata/influx-cli/blob/main/api/contract/README.md Create a new branch to track your modifications to the API contract. ```shell git checkout ``` -------------------------------- ### Update OpenAPI Submodule Source: https://github.com/influxdata/influx-cli/blob/main/README.md Update the OpenAPI Git submodule to fetch the latest API contracts and regenerate client code using Docker. ```bash git pull --recurse-submodules ``` ```bash make openapi ``` -------------------------------- ### Update Submodule Reference in Main Repo Source: https://github.com/influxdata/influx-cli/blob/main/api/contract/README.md Stage and commit the updated submodule reference from the main repository. ```shell git add api/contract/openapi git commit ``` -------------------------------- ### Simple CSV File to Line Protocol Source: https://github.com/influxdata/influx-cli/blob/main/pkg/csv2lp/README.md Converts a simple CSV file into InfluxDB Line Protocol. Data types can be specified in the header row. ```bash #datatype measurement,tag,tag,double,double,ignored,dateTime:number m,cpu,host,time_steal,usage_user,nothing,time cpu,cpu1,rsavage.prod,0,2.7,a,1482669077000000000 cpu,cpu1,rsavage.prod,0,2.2,b,1482669087000000000 ``` ```plaintext cpu,cpu=cpu1,host=rsavage.prod time_steal=0,usage_user=2.7 1482669077000000000 cpu,cpu=cpu1,host=rsavage.prod time_steal=0,usage_user=2.2 1482669087000000000 ``` ```bash m|measurement,cpu|tag,host|tag,time_steal|double,usage_user|double,nothing|ignored,time|dateTime:number cpu,cpu1,rsavage.prod,0,2.7,a,1482669077000000000 cpu,cpu1,rsavage.prod,0,2.2,b,1482669087000000000 ``` -------------------------------- ### Push Submodule Branch Changes Source: https://github.com/influxdata/influx-cli/blob/main/api/contract/README.md Push your branch containing changes within the OpenAPI submodule to GitHub. ```shell cd api/contract/openapi && git push ``` -------------------------------- ### Update Submodule to Merge Result Source: https://github.com/influxdata/influx-cli/blob/main/api/contract/README.md After merging changes in the OpenAPI repository, update your submodule to point to the latest merge result. ```shell cd api/contract/openapi && git fetch && git checkout master && git pull origin master ``` -------------------------------- ### Flux Query Result to Line Protocol Source: https://github.com/influxdata/influx-cli/blob/main/pkg/csv2lp/README.md Converts CSV output from a Flux query into InfluxDB Line Protocol. Ensure the CSV adheres to the expected Flux output format. ```bash #group,false,false,true,true,false,false,true,true,true,true #datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string,string,string #default,_result,,,,,,,,, ,result,table,_start,_stop,_time,_value,_field,_measurement,cpu,host ,,0,2020-02-25T22:17:54.068926364Z,2020-02-25T22:22:54.068926364Z,2020-02-25T22:17:57Z,0,time_steal,cpu,cpu1,rsavage.prod ,,0,2020-02-25T22:17:54.068926364Z,2020-02-25T22:22:54.068926364Z,2020-02-25T22:18:07Z,0,time_steal,cpu,cpu1,rsavage.prod #group,false,false,true,true,false,false,true,true,true,true #datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string,string,string #default,_result,,,,,,,,, ,result,table,_start,_stop,_time,_value,_field,_measurement,cpu,host ,,1,2020-02-25T22:17:54.068926364Z,2020-02-25T22:22:54.068926364Z,2020-02-25T22:18:01Z,2.7263631815907954,usage_user,cpu,cpu-total,tahoecity.prod ,,1,2020-02-25T22:17:54.068926364Z,2020-02-25T22:22:54.068926364Z,2020-02-25T22:18:11Z,2.247752247752248,usage_user,cpu,cpu-total,tahoecity.prod ``` ```plaintext cpu,cpu=cpu1,host=rsavage.prod time_steal=0 1582669077000000000 cpu,cpu=cpu1,host=rsavage.prod time_steal=0 1582669087000000000 cpu,cpu=cpu-total,host=tahoecity.prod usage_user=2.7263631815907954 1582669081000000000 cpu,cpu=cpu-total,host=tahoecity.prod usage_user=2.247752247752248 1582669091000000000 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.