Skip to content

CLI configuration not working? #854

Answered by donmccurdy
robertoranon asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @robertoranon! You'll need to export a configuration definition, glTF Transform cannot detect new commands from the function declaration alone. Something like this should work:

// Custom transform: convert materials
function convertMaterials(options) {
    return (document) => {
        for (const material of document.getRoot().listMaterials()) {
            console.log(material);
        }
    };
}

export default {
 onProgramReady: ({ program, io, Session }) => {
     // Usage: https://caporal.io/
     program
         .command('convertMaterials', 'Convert materials')
         .help('Lorem ipsum dolorem...')
         .argument('<input>', 'Path to read glTF 2.0 (.glb, .gltf) model')

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by robertoranon
Comment options

You must be logged in to vote
1 reply
@donmccurdy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants